Source:
protected AddToFactsResult addToFacts( InputRow row, IncrementalIndexRow key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier, boolean skipMaxRowsInMemoryCheck ) throws IndexSizeExceededException { List<String> parseExceptionMessages; final int priorIndex = facts.getPriorIndex(key); Aggregator[] aggs; AggregatorFactory[] metrics = getMetrics(); AtomicInteger numEntries = getNumEntries(); AtomicLong sizeInBytes = getBytesInMemory(); if (IncrementalIndexRow.EMPTY_ROW_INDEX != priorIndex) { aggs = concurrentGet(priorIndex); parseExceptionMessages = doAggregate(metrics, aggs, rowContainer, row); } else { aggs = new Aggregator[metrics.length]; factorizeAggs(metrics, aggs, rowContainer, row); parseExceptionMessages = doAggregate(metrics, aggs, rowContainer, row); final int rowIndex = indexIncrement.getAndIncrement(); concurrentSet(rowIndex, aggs); if ((numEntries.get() >= maxRowCount || sizeInBytes.get() >= maxBytesInMemory) && facts.getPriorIndex(key) == IncrementalIndexRow.EMPTY_ROW_INDEX && !skipMaxRowsInMemoryCheck) { throw new IndexSizeExceededException( "Maximum number of rows [%d] or max size in bytes [%d] reached", maxRowCount, maxBytesInMemory ); } final int prev = facts.putIfAbsent(key, rowIndex); if (IncrementalIndexRow.EMPTY_ROW_INDEX == prev) { numEntries.incrementAndGet(); long estimatedRowSize = estimateRowSizeInBytes(key, maxBytesPerRowForAggregators); sizeInBytes.addAndGet(estimatedRowSize); } else { aggs = concurrentGet(prev); parseExceptionMessages = doAggregate(metrics, aggs, rowContainer, row); concurrentRemove(rowIndex); } } return new AddToFactsResult(numEntries.get(), sizeInBytes.get(), parseExceptionMessages); }

Target:
protected AddToFactsResult addToFacts( InputRow row, IncrementalIndexRow key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier, boolean skipMaxRowsInMemoryCheck ) throws IndexSizeExceededException { List<String> parseExceptionMessages; final int priorIndex = facts.getPriorIndex(key); Aggregator[] aggs; final AggregatorFactory[] metrics = getMetrics(); final AtomicInteger numEntries = getNumEntries(); final AtomicLong sizeInBytes = getBytesInMemory(); if (IncrementalIndexRow.EMPTY_ROW_INDEX != priorIndex) { aggs = concurrentGet(priorIndex); parseExceptionMessages = doAggregate(metrics, aggs, rowContainer, row); } else { aggs = new Aggregator[metrics.length]; factorizeAggs(metrics, aggs, rowContainer, row); parseExceptionMessages = doAggregate(metrics, aggs, rowContainer, row); final int rowIndex = indexIncrement.getAndIncrement(); concurrentSet(rowIndex, aggs); if ((numEntries.get() >= maxRowCount || sizeInBytes.get() >= maxBytesInMemory) && facts.getPriorIndex(key) == IncrementalIndexRow.EMPTY_ROW_INDEX && !skipMaxRowsInMemoryCheck) { throw new IndexSizeExceededException( "Maximum number of rows [%d] or max size in bytes [%d] reached", maxRowCount, maxBytesInMemory ); } final int prev = facts.putIfAbsent(key, rowIndex); if (IncrementalIndexRow.EMPTY_ROW_INDEX == prev) { numEntries.incrementAndGet(); long estimatedRowSize = estimateRowSizeInBytes(key, maxBytesPerRowForAggregators); sizeInBytes.addAndGet(estimatedRowSize); } else { aggs = concurrentGet(prev); parseExceptionMessages = doAggregate(metrics, aggs, rowContainer, row); concurrentRemove(rowIndex); } } return new AddToFactsResult(numEntries.get(), sizeInBytes.get(), parseExceptionMessages); }