Source:
<code>protected AddToFactsResult addToFacts( InputRow row, IncrementalIndexRow key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier, boolean skipMaxRowsInMemoryCheck ) throws IndexSizeExceededException { final Integer priorIdex = getFacts().getPriorIndex(key); Aggregator[] aggs; AggregatorFactory[] metrics = getMetrics(); AtomicInteger numEntries = getNumEntries(); <START> AtomicLong sizeInBytes = getBytesInMemory(); <END> 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, getDeserializeComplexMetrics()) ); } 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 (getReportParseExceptions()) { throw e; } } } } rowContainer.set(null); return new AddToFactsResult(numEntries.get(), sizeInBytes.get(), new ArrayList<>()); }</code><technical_language>final too</technical_language>

Target:
protected AddToFactsResult addToFacts( InputRow row, IncrementalIndexRow key, ThreadLocal<InputRow> rowContainer, Supplier<InputRow> rowSupplier, boolean skipMaxRowsInMemoryCheck ) throws IndexSizeExceededException { final Integer priorIdex = getFacts().getPriorIndex(key); Aggregator[] aggs; final AggregatorFactory[] metrics = getMetrics(); final AtomicInteger numEntries = getNumEntries(); final AtomicLong sizeInBytes = getBytesInMemory(); 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, getDeserializeComplexMetrics()) ); } 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 (getReportParseExceptions()) { throw e; } } } } rowContainer.set(null); return new AddToFactsResult(numEntries.get(), sizeInBytes.get(), new ArrayList<>()); }