Source:
public SpillingGrouper( final Supplier<ByteBuffer> bufferSupplier, final KeySerdeFactory<KeyType> keySerdeFactory, final ColumnSelectorFactory columnSelectorFactory, final AggregatorFactory[] aggregatorFactories, final int bufferGrouperMaxSize, final float bufferGrouperMaxLoadFactor, final int bufferGrouperInitialBuckets, final LimitedTemporaryStorage temporaryStorage, final ObjectMapper spillMapper, final boolean spillingAllowed, final DefaultLimitSpec limitSpec, final boolean sortHasNonGroupingFields, final int mergeBufferSize ) { this.keySerde = keySerdeFactory.factorize(); this.keyObjComparator = keySerdeFactory.objectComparator(false); this.defaultOrderKeyObjComparator = keySerdeFactory.objectComparator(true); if (limitSpec != null) { LimitedBufferHashGrouper<KeyType> limitGrouper = new LimitedBufferHashGrouper<>( bufferSupplier, keySerde, columnSelectorFactory, aggregatorFactories, bufferGrouperMaxSize, bufferGrouperMaxLoadFactor, bufferGrouperInitialBuckets, limitSpec.getLimit(), sortHasNonGroupingFields ); if (!limitGrouper.validateBufferCapacity(mergeBufferSize)) { if (sortHasNonGroupingFields) { log.info("Ignoring forceLimitPushDown, insufficient buffer capacity."); } this.grouper = new BufferHashGrouper<>( bufferSupplier, keySerde, columnSelectorFactory, aggregatorFactories, bufferGrouperMaxSize, bufferGrouperMaxLoadFactor, bufferGrouperInitialBuckets, sortHasNonGroupingFields ); } else { this.grouper = limitGrouper; } } else { this.grouper = new BufferHashGrouper<>( bufferSupplier, keySerde, columnSelectorFactory, aggregatorFactories, bufferGrouperMaxSize, bufferGrouperMaxLoadFactor, bufferGrouperInitialBuckets, true ); } this.aggregatorFactories = aggregatorFactories; this.temporaryStorage = temporaryStorage; this.spillMapper = spillMapper; this.spillingAllowed = spillingAllowed; this.sortHasNonGroupingFields = sortHasNonGroupingFields; }

Target:
public SpillingGrouper( final Supplier<ByteBuffer> bufferSupplier, final KeySerdeFactory<KeyType> keySerdeFactory, final ColumnSelectorFactory columnSelectorFactory, final AggregatorFactory[] aggregatorFactories, final int bufferGrouperMaxSize, final float bufferGrouperMaxLoadFactor, final int bufferGrouperInitialBuckets, final LimitedTemporaryStorage temporaryStorage, final ObjectMapper spillMapper, final boolean spillingAllowed, final DefaultLimitSpec limitSpec, final boolean sortHasNonGroupingFields, final int mergeBufferSize ) { this.keySerde = keySerdeFactory.factorize(); this.keyObjComparator = keySerdeFactory.objectComparator(false); this.defaultOrderKeyObjComparator = keySerdeFactory.objectComparator(true); if (limitSpec != null) { LimitedBufferHashGrouper<KeyType> limitGrouper = new LimitedBufferHashGrouper<>( bufferSupplier, keySerde, columnSelectorFactory, aggregatorFactories, bufferGrouperMaxSize, bufferGrouperMaxLoadFactor, bufferGrouperInitialBuckets, limitSpec.getLimit(), sortHasNonGroupingFields ); if (!limitGrouper.validateBufferCapacity(mergeBufferSize)) { if (sortHasNonGroupingFields) { log.debug("Ignoring forceLimitPushDown, insufficient buffer capacity."); } this.grouper = new BufferHashGrouper<>( bufferSupplier, keySerde, columnSelectorFactory, aggregatorFactories, bufferGrouperMaxSize, bufferGrouperMaxLoadFactor, bufferGrouperInitialBuckets, sortHasNonGroupingFields ); } else { this.grouper = limitGrouper; } } else { this.grouper = new BufferHashGrouper<>( bufferSupplier, keySerde, columnSelectorFactory, aggregatorFactories, bufferGrouperMaxSize, bufferGrouperMaxLoadFactor, bufferGrouperInitialBuckets, true ); } this.aggregatorFactories = aggregatorFactories; this.temporaryStorage = temporaryStorage; this.spillMapper = spillMapper; this.spillingAllowed = spillingAllowed; this.sortHasNonGroupingFields = sortHasNonGroupingFields; }