Package org.apache.druid.query.groupby
Class GroupByQueryRunnerFactory
java.lang.Object
org.apache.druid.query.groupby.GroupByQueryRunnerFactory
- All Implemented Interfaces:
QueryRunnerFactory<ResultRow,GroupByQuery>
public class GroupByQueryRunnerFactory
extends Object
implements QueryRunnerFactory<ResultRow,GroupByQuery>
-
Constructor Summary
ConstructorsConstructorDescriptionGroupByQueryRunnerFactory(GroupingEngine groupingEngine, GroupByQueryQueryToolChest toolChest, NonBlockingPool<ByteBuffer> processingBufferPool) -
Method Summary
Modifier and TypeMethodDescriptioncreateRunner(Segment segment) Given a specific segment, this method will create aQueryRunner.Provides access to theQueryToolChestfor this specificQuerytype.mergeRunners(QueryProcessingPool queryProcessingPool, Iterable<QueryRunner<ResultRow>> queryRunners) Runners generated with createRunner() and combined into an Iterable in (time,shardId) order are passed along to this method with anQueryProcessingPool.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.query.QueryRunnerFactory
mergeRunners
-
Constructor Details
-
GroupByQueryRunnerFactory
@Inject public GroupByQueryRunnerFactory(GroupingEngine groupingEngine, GroupByQueryQueryToolChest toolChest, NonBlockingPool<ByteBuffer> processingBufferPool)
-
-
Method Details
-
createRunner
Description copied from interface:QueryRunnerFactoryGiven a specific segment, this method will create aQueryRunner. TheQueryRunner, when asked, will generate aSequenceof results based on the given segment. This is the meat of theQueryprocessing and is where the results are actually generated. Everything else is just merging and reduction logic.- Specified by:
createRunnerin interfaceQueryRunnerFactory<ResultRow,GroupByQuery> - Parameters:
segment- The segment to process- Returns:
- A
QueryRunnerthat, when asked, will generate aSequenceof results based on the given segment
-
mergeRunners
public QueryRunner<ResultRow> mergeRunners(QueryProcessingPool queryProcessingPool, Iterable<QueryRunner<ResultRow>> queryRunners) Description copied from interface:QueryRunnerFactoryRunners generated with createRunner() and combined into an Iterable in (time,shardId) order are passed along to this method with anQueryProcessingPool. The method should then return aQueryRunnerthat, when asked, will use theQueryProcessingPoolto run the base QueryRunners in some fashion. The vast majority of the time, this should be implemented withChainedExecutionQueryRunner: return new ChainedExecutionQueryRunner<>(queryProcessingPool, toolChest.getOrdering(), queryWatcher, queryRunners); Which will allow for parallel execution up to the maximum number of processing threads allowed. UnlikeQueryRunnerFactory.mergeRunners(ExecutorService, Iterable), this method takes aQueryProcessingPoolinstead which allows custom implementations for prioritize query execution on segments.- Specified by:
mergeRunnersin interfaceQueryRunnerFactory<ResultRow,GroupByQuery> - Parameters:
queryProcessingPool-QueryProcessingPoolto be used for parallel processingqueryRunners- IndividualQueryRunnerobjects that produce some results- Returns:
- a
QueryRunnerthat, when asked, will use theExecutorServiceto run the baseQueryRunnercollection. - See Also:
-
getToolchest
Description copied from interface:QueryRunnerFactoryProvides access to theQueryToolChestfor this specificQuerytype.- Specified by:
getToolchestin interfaceQueryRunnerFactory<ResultRow,GroupByQuery> - Returns:
- an instance of the toolchest for this specific query type.
-
getGroupingEngine
-