Package org.apache.druid.query
Interface QueryRunnerFactory<T,QueryType extends Query<T>>
-
- All Known Implementing Classes:
DataSourceMetadataQueryRunnerFactory,GroupByQueryRunnerFactory,ScanQueryRunnerFactory,SearchQueryRunnerFactory,SegmentMetadataQueryRunnerFactory,TimeBoundaryQueryRunnerFactory,TimeseriesQueryRunnerFactory,TopNQueryRunnerFactory,WindowOperatorQueryQueryRunnerFactory
public interface QueryRunnerFactory<T,QueryType extends Query<T>>An interface that defines the nitty gritty implementation details of a Query on a Segment
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description QueryRunner<T>createRunner(Segment segment)Given a specific segment, this method will create aQueryRunner.QueryToolChest<T,QueryType>getToolchest()Provides access to theQueryToolChestfor this specificQuerytype.default QueryRunner<T>mergeRunners(ExecutorService queryExecutor, Iterable<QueryRunner<T>> queryRunners)Deprecated.UsemergeRunners(QueryProcessingPool, Iterable)instead.QueryRunner<T>mergeRunners(QueryProcessingPool queryProcessingPool, Iterable<QueryRunner<T>> queryRunners)Runners generated with createRunner() and combined into an Iterable in (time,shardId) order are passed along to this method with anQueryProcessingPool.
-
-
-
Method Detail
-
createRunner
QueryRunner<T> createRunner(Segment segment)
Given 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.- Parameters:
segment- The segment to process- Returns:
- A
QueryRunnerthat, when asked, will generate aSequenceof results based on the given segment
-
mergeRunners
@Deprecated default QueryRunner<T> mergeRunners(ExecutorService queryExecutor, Iterable<QueryRunner<T>> queryRunners)
Deprecated.UsemergeRunners(QueryProcessingPool, Iterable)instead. Runners generated with createRunner() and combined into an Iterable in (time,shardId) order are passed along to this method with anExecutorService. The method should then return aQueryRunnerthat, when asked, will use theExecutorServiceto run the base QueryRunners in some fashion. The vast majority of the time, this should be implemented withChainedExecutionQueryRunner: return new ChainedExecutionQueryRunner<>(queryExecutor, toolChest.getOrdering(), queryWatcher, queryRunners); Which will allow for parallel execution up to the maximum number of processing threads allowed.- Parameters:
queryExecutor-ExecutorServiceto be used for parallel processingqueryRunners- IndividualQueryRunnerobjects that produce some results- Returns:
- a
QueryRunnerthat, when asked, will use theExecutorServiceto run the baseQueryRunnercollection.
-
mergeRunners
QueryRunner<T> mergeRunners(QueryProcessingPool queryProcessingPool, Iterable<QueryRunner<T>> queryRunners)
Runners 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. UnlikemergeRunners(ExecutorService, Iterable), this method takes aQueryProcessingPoolinstead which allows custom implementations for prioritize query execution on segments.- Parameters:
queryProcessingPool-QueryProcessingPoolto be used for parallel processingqueryRunners- IndividualQueryRunnerobjects that produce some results- Returns:
- a
QueryRunnerthat, when asked, will use theExecutorServiceto run the baseQueryRunnercollection.
-
getToolchest
QueryToolChest<T,QueryType> getToolchest()
Provides access to theQueryToolChestfor this specificQuerytype.- Returns:
- an instance of the toolchest for this specific query type.
-
-