Source:
protected AddToFactsResult addToFacts( AggregatorFactory[] metrics, boolean deserializeComplexMetrics, boolean reportParseExceptions, InputRow row, AtomicInteger numEntries, AtomicLong sizeInBytes, IncrementalIndexRow key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier, boolean skipMaxRowsInMemoryCheck ) throws IndexSizeExceededException { final Integer priorIdex = getFacts().getPriorIndex(key); Aggregator[] aggs; if (null != priorIdex) { aggs = indexedMap.get(priorIdex); } else { aggs = new Aggregator[metrics.length]; for (int i = 0; i < metrics.length; i++) { final AggregatorFactory agg = metrics[i]; aggs[i] = agg.factorize( makeColumnSelectorFactory(agg, rowSupplier, deserializeComplexMetrics) ); } Integer rowIndex; do { rowIndex = indexIncrement.incrementAndGet(); } while (null != indexedMap.putIfAbsent(rowIndex, aggs)); if (numEntries.get() >= maxRowCount || sizeInBytes.get() >= maxBytesInMemory && getFacts().getPriorIndex(key) == IncrementalIndexRow.EMPTY_ROW_INDEX) { throw new IndexSizeExceededException("Maximum number of rows or max bytes reached"); } final int prev = getFacts().putIfAbsent(key, rowIndex); if (IncrementalIndexRow.EMPTY_ROW_INDEX == prev) { numEntries.incrementAndGet(); sizeInBytes.incrementAndGet(); } else { aggs = indexedMap.get(prev); indexedMap.remove(rowIndex); } } rowContainer.set(row); for (Aggregator agg : aggs) { synchronized (agg) { try { agg.aggregate(); } catch (ParseException e) { if (reportParseExceptions) { throw e; } } } } rowContainer.set(null); return new AddToFactsResult(numEntries.get(), sizeInBytes.get(), new ArrayList<>()); }

Target:
protected AddToFactsResult addToFacts( AggregatorFactory[] metrics, boolean deserializeComplexMetrics, boolean reportParseExceptions, InputRow row, AtomicInteger numEntries, AtomicLong sizeInBytes, IncrementalIndexRow key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier, boolean skipMaxRowsInMemoryCheck ) throws IndexSizeExceededException { final Integer priorIdex = getFacts().getPriorIndex(key); Aggregator[] aggs; if (null != priorIdex) { aggs = indexedMap.get(priorIdex); } else { aggs = new Aggregator[metrics.length]; for (int i = 0; i < metrics.length; i++) { final AggregatorFactory agg = metrics[i]; aggs[i] = agg.factorize( makeColumnSelectorFactory(agg, rowSupplier, deserializeComplexMetrics) ); } Integer rowIndex; do { rowIndex = indexIncrement.incrementAndGet(); } while (null != indexedMap.putIfAbsent(rowIndex, aggs)); if ((numEntries.get() >= maxRowCount || sizeInBytes.get() >= maxBytesInMemory) && getFacts().getPriorIndex(key) == IncrementalIndexRow.EMPTY_ROW_INDEX) { throw new IndexSizeExceededException("Maximum number of rows or max bytes reached"); } final int prev = getFacts().putIfAbsent(key, rowIndex); if (IncrementalIndexRow.EMPTY_ROW_INDEX == prev) { numEntries.incrementAndGet(); sizeInBytes.incrementAndGet(); } else { aggs = indexedMap.get(prev); indexedMap.remove(rowIndex); } } rowContainer.set(row); for (Aggregator agg : aggs) { synchronized (agg) { try { agg.aggregate(); } catch (ParseException e) { if (reportParseExceptions) { throw e; } } } } rowContainer.set(null); return new AddToFactsResult(numEntries.get(), sizeInBytes.get(), new ArrayList<>()); }