Source:
<code>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 { List<String> parseExceptionMessages; final int priorIndex = facts.getPriorIndex(key); Aggregator[] aggs; 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 <START> || (maxBytesInMemory != -1 && sizeInBytes.get() >= maxBytesInMemory) <END> && 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); }</code><technical_language>maxBytesInMemory > 0 (<LINK_0></technical_language>

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 { List<String> parseExceptionMessages; final int priorIndex = facts.getPriorIndex(key); Aggregator[] aggs; 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 || (maxBytesInMemory > 0 && 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); }