public class ScanQueryRunnerFactory extends Object implements QueryRunnerFactory<ScanResultValue,ScanQuery>
Constructor and Description |
---|
ScanQueryRunnerFactory(ScanQueryQueryToolChest toolChest,
ScanQueryEngine engine,
ScanQueryConfig scanQueryConfig) |
Modifier and Type | Method and Description |
---|---|
QueryRunner<ScanResultValue> |
createRunner(Segment segment)
Given a specific segment, this method will create a
QueryRunner . |
QueryToolChest<ScanResultValue,ScanQuery> |
getToolchest()
Provides access to the
QueryToolChest for this specific Query type. |
QueryRunner<ScanResultValue> |
mergeRunners(ExecutorService queryExecutor,
Iterable<QueryRunner<ScanResultValue>> queryRunners)
Runners generated with createRunner() and combined into an Iterable in (time,shardId) order are passed
along to this method with an
ExecutorService . |
@Inject public ScanQueryRunnerFactory(ScanQueryQueryToolChest toolChest, ScanQueryEngine engine, ScanQueryConfig scanQueryConfig)
public QueryRunner<ScanResultValue> createRunner(Segment segment)
QueryRunnerFactory
QueryRunner
.
The QueryRunner
, when asked, will generate a Sequence
of
results based on the given segment. This is the meat of the Query
processing and is where the results are
actually generated. Everything else is just merging and reduction logic.createRunner
in interface QueryRunnerFactory<ScanResultValue,ScanQuery>
segment
- The segment to processQueryRunner
that, when asked, will generate a
Sequence
of results based on the given segmentpublic QueryRunner<ScanResultValue> mergeRunners(ExecutorService queryExecutor, Iterable<QueryRunner<ScanResultValue>> queryRunners)
QueryRunnerFactory
ExecutorService
. The method should then return a QueryRunner
that,
when asked, will use the ExecutorService
to run the base QueryRunners in some fashion.
The vast majority of the time, this should be implemented with ChainedExecutionQueryRunner
:
return new ChainedExecutionQueryRunner<>(queryExecutor, toolChest.getOrdering(), queryWatcher, queryRunners);
Which will allow for parallel execution up to the maximum number of processing threads allowed.mergeRunners
in interface QueryRunnerFactory<ScanResultValue,ScanQuery>
queryExecutor
- ExecutorService
to be used for parallel processingqueryRunners
- Individual QueryRunner
objects that produce some resultsQueryRunner
that, when asked, will use the ExecutorService
to run the base
QueryRunner
collection.public QueryToolChest<ScanResultValue,ScanQuery> getToolchest()
QueryRunnerFactory
QueryToolChest
for this specific Query
type.getToolchest
in interface QueryRunnerFactory<ScanResultValue,ScanQuery>
Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.