Class RowBasedGrouperHelper
java.lang.Object
org.apache.druid.query.groupby.epinephelinae.RowBasedGrouperHelper
This class contains shared code between
GroupByMergingQueryRunner and GroupByRowProcessor.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncreateGrouperAccumulatorPair(GroupByQuery query, GroupByQuery subquery, GroupByQueryConfig config, DruidProcessingConfig processingConfig, com.google.common.base.Supplier<ByteBuffer> bufferSupplier, ReferenceCountingResourceHolder<ByteBuffer> combineBufferHolder, int concurrencyHint, LimitedTemporaryStorage temporaryStorage, com.fasterxml.jackson.databind.ObjectMapper spillMapper, com.google.common.util.concurrent.ListeningExecutorService grouperSorter, int priority, boolean hasQueryTimeout, long queryTimeoutAt, int mergeBufferSize, GroupByStatsProvider.PerQueryStats perQueryStats) Create aGrouperthat groups according to the dimensions and aggregators in "query", along with anAccumulatorthat accepts ResultRows and forwards them to the grouper.createGrouperAccumulatorPair(GroupByQuery query, GroupByQuery subquery, GroupByQueryConfig config, DruidProcessingConfig processingConfig, com.google.common.base.Supplier<ByteBuffer> bufferSupplier, LimitedTemporaryStorage temporaryStorage, com.fasterxml.jackson.databind.ObjectMapper spillMapper, int mergeBufferSize, GroupByStatsProvider.PerQueryStats perQueryStats) Create a single-threaded grouper and accumulator.static ColumnSelectorFactorycreateResultRowBasedColumnSelectorFactory(GroupByQuery query, com.google.common.base.Supplier<ResultRow> supplier, RowSignature.Finalization finalization) Creates aColumnSelectorFactorythat can read rows which originate as results of the provided "query".makeGrouperIterator(Grouper<RowBasedGrouperHelper.RowBasedKey> grouper, GroupByQuery query, Closeable closeable) makeGrouperIterator(Grouper<RowBasedGrouperHelper.RowBasedKey> grouper, GroupByQuery query, List<DimensionSpec> dimsToInclude, Closeable closeable)
-
Method Details
-
createGrouperAccumulatorPair
public static Pair<Grouper<RowBasedGrouperHelper.RowBasedKey>,Accumulator<AggregateResult, createGrouperAccumulatorPairResultRow>> (GroupByQuery query, @Nullable GroupByQuery subquery, GroupByQueryConfig config, DruidProcessingConfig processingConfig, com.google.common.base.Supplier<ByteBuffer> bufferSupplier, LimitedTemporaryStorage temporaryStorage, com.fasterxml.jackson.databind.ObjectMapper spillMapper, int mergeBufferSize, GroupByStatsProvider.PerQueryStats perQueryStats) Create a single-threaded grouper and accumulator. -
createGrouperAccumulatorPair
public static Pair<Grouper<RowBasedGrouperHelper.RowBasedKey>,Accumulator<AggregateResult, createGrouperAccumulatorPairResultRow>> (GroupByQuery query, @Nullable GroupByQuery subquery, GroupByQueryConfig config, DruidProcessingConfig processingConfig, com.google.common.base.Supplier<ByteBuffer> bufferSupplier, @Nullable ReferenceCountingResourceHolder<ByteBuffer> combineBufferHolder, int concurrencyHint, LimitedTemporaryStorage temporaryStorage, com.fasterxml.jackson.databind.ObjectMapper spillMapper, @Nullable com.google.common.util.concurrent.ListeningExecutorService grouperSorter, int priority, boolean hasQueryTimeout, long queryTimeoutAt, int mergeBufferSize, GroupByStatsProvider.PerQueryStats perQueryStats) Create aGrouperthat groups according to the dimensions and aggregators in "query", along with anAccumulatorthat accepts ResultRows and forwards them to the grouper.The pair will operate in one of two modes:
1) Combining mode (used if "subquery" is null). In this mode, filters from the "query" are ignored, and its aggregators are converted into combining form. The input ResultRows are assumed to be partially-grouped results originating from the provided "query".
2) Subquery mode (used if "subquery" is nonnull). In this mode, filters from the "query" (both intervals and dim filters) are respected, and its aggregators are used in standard (not combining) form. The input ResultRows are assumed to be results originating from the provided "subquery".
- Parameters:
query- query that we are grouping forsubquery- optional subquery that we are receiving results from (see combining vs. subquery mode above)config- groupBy query configprocessingConfig- processing configbufferSupplier- supplier of merge bufferscombineBufferHolder- holder of combine buffers. Unused if concurrencyHint = -1, and may be null in that caseconcurrencyHint- -1 for single-threaded Grouper, >=1 for concurrent GroupertemporaryStorage- temporary storage used for spilling from the GrouperspillMapper- object mapper used for spilling from the GroupergrouperSorter- executor service used for parallel combining. Unused if concurrencyHint = -1, and may be null in that casepriority- query priorityhasQueryTimeout- whether or not this query has a timeoutqueryTimeoutAt- when this query times out, in milliseconds since the epochmergeBufferSize- size of the merge buffers from "bufferSupplier"
-
createResultRowBasedColumnSelectorFactory
public static ColumnSelectorFactory createResultRowBasedColumnSelectorFactory(GroupByQuery query, com.google.common.base.Supplier<ResultRow> supplier, RowSignature.Finalization finalization) Creates aColumnSelectorFactorythat can read rows which originate as results of the provided "query".- Parameters:
query- a groupBy querysupplier- supplier of result rows from the queryfinalization- whether the column capabilities reported by this factory should reflect finalized types
-
makeGrouperIterator
public static CloseableGrouperIterator<RowBasedGrouperHelper.RowBasedKey,ResultRow> makeGrouperIterator(Grouper<RowBasedGrouperHelper.RowBasedKey> grouper, GroupByQuery query, Closeable closeable) -
makeGrouperIterator
public static CloseableGrouperIterator<RowBasedGrouperHelper.RowBasedKey,ResultRow> makeGrouperIterator(Grouper<RowBasedGrouperHelper.RowBasedKey> grouper, GroupByQuery query, @Nullable List<DimensionSpec> dimsToInclude, Closeable closeable)
-