Class Generic2AggPooledTopNScannerPrototype

java.lang.Object
org.apache.druid.query.topn.Generic2AggPooledTopNScannerPrototype
All Implemented Interfaces:
Generic2AggPooledTopNScanner

public final class Generic2AggPooledTopNScannerPrototype extends Object implements Generic2AggPooledTopNScanner
  • Constructor Details

    • Generic2AggPooledTopNScannerPrototype

      public Generic2AggPooledTopNScannerPrototype()
  • Method Details

    • scanAndAggregate

      public long scanAndAggregate(DimensionSelector dimensionSelector, BufferAggregator aggregator1, int aggregator1Size, BufferAggregator aggregator2, int aggregator2Size, Cursor cursor, CursorGranularizer granularizer, int[] positions, ByteBuffer resultsBuffer)
      Any changes to this method should be coordinated with TopNUtils, PooledTopNAlgorithm.computeSpecializedScanAndAggregateImplementations() and downstream methods. It should be checked with a tool like https://github.com/AdoptOpenJDK/jitwatch that C2 compiler output for this method doesn't have any method calls in the while loop, i. e. all method calls are inlined. To be able to see assembly of this method in JITWatch and other similar tools, PooledTopNAlgorithm.SPECIALIZE_GENERIC_TWO_AGG_POOLED_TOPN should be turned off. Note that in this case the benchmark should be "naturally monomorphic", i. e. execute this method always with the same runtime shape. If the while loop contains not inlined method calls, it should be considered as a performance bug.
      Specified by:
      scanAndAggregate in interface Generic2AggPooledTopNScanner
      aggregator1Size - number of bytes required by aggregator1 for a single aggregation
      aggregator2Size - number of bytes required by aggregator2 for a single aggregation
      positions - a cache for positions in resultsBuffer, where specific (indexed) dimension values are aggregated
      Returns:
      number of scanned rows, i. e. number of steps made with the given cursor