Class ComputeService
org.elasticsearch.xpack.esql.plugin.ComputeService#execute
This method is responsible for splitting physical plan into coordinator and data node plans.
Coordinator plan is immediately executed locally (using org.elasticsearch.xpack.esql.plugin.ComputeService#runCompute)
and is prepared to collect and merge pages from data nodes into the final query result.
Data node plan is passed to org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#startComputeOnDataNodes
that is responsible for
-
Determining list of nodes that contain shards referenced by the query with
org.elasticsearch.xpack.esql.plugin.DataNodeRequestSender#searchShards -
Each node in the list processed in
org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#startComputeOnDataNodesin order to- Open ExchangeSink on the target data node and link it with local ExchangeSource for the query using `internal:data/read/esql/open_exchange` transport request.
- Start data node plan execution on the target data node using `indices:data/read/esql/data` transport request
- While coordinator plan executor is running it will read data from ExchangeSource that will poll pages from linked ExchangeSink on target data nodes or notify them that data set is already completed (for example when running FROM * | LIMIT 10 type of query) or query is canceled using `internal:data/read/esql/exchange` transport requests.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionComputeService(TransportActionServices transportActionServices, EnrichLookupService enrichLookupService, LookupFromIndexService lookupFromIndexService, ThreadPool threadPool, BigArrays bigArrays, BlockFactory blockFactory, OperatorFactoryRegistry operatorFactoryRegistry, FormatReaderRegistry formatReaderRegistry) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanSkipSplitDiscovery(PhysicalPlan plan, FormatReaderRegistry formatReaderRegistry) Returnstruewhen split discovery (Phase 2 footer reads) can be skipped because every fragment inplanthat references anExternalRelationis a pure ungroupedAggregatedirectly over that relation, the relation'ssourceMetadataalready contains complete (non-partial) statistics, and the fragment's aggregate functions are metadata-pushable for that source's format reader (i.e.voidexecute(String sessionId, CancellableTask rootTask, EsqlFlags flags, PhysicalPlan physicalPlan, Configuration configuration, FoldContext foldContext, EsqlExecutionInfo execInfo, PlanTimeProfile planTimeProfile, ActionListener<Result> listener) voidexecutePlan(String sessionId, CancellableTask rootTask, EsqlFlags flags, PhysicalPlan physicalPlan, Configuration configuration, FoldContext foldContext, EsqlExecutionInfo execInfo, String profileQualifier, ActionListener<Result> listener, Supplier<ExchangeSink> exchangeSinkSupplier, Map<String, EsqlExecutionInfo.Cluster.Status> initialClusterStatuses, PlanTimeProfile planTimeProfile) static ReductionPlanreductionPlan(PlannerSettings plannerSettings, EsqlFlags flags, Configuration configuration, FoldContext foldCtx, ExchangeSinkExec originalPlan, boolean runNodeLevelReduction, boolean reduceNodeLateMaterialization, PlanTimeProfile planTimeProfile)
-
Field Details
-
DATA_DESCRIPTION
- See Also:
-
REDUCE_DESCRIPTION
- See Also:
-
DATA_ACTION_NAME
- See Also:
-
CLUSTER_ACTION_NAME
- See Also:
-
-
Constructor Details
-
ComputeService
public ComputeService(TransportActionServices transportActionServices, EnrichLookupService enrichLookupService, LookupFromIndexService lookupFromIndexService, ThreadPool threadPool, BigArrays bigArrays, BlockFactory blockFactory, OperatorFactoryRegistry operatorFactoryRegistry, FormatReaderRegistry formatReaderRegistry)
-
-
Method Details
-
canSkipSplitDiscovery
public static boolean canSkipSplitDiscovery(PhysicalPlan plan, FormatReaderRegistry formatReaderRegistry) Returnstruewhen split discovery (Phase 2 footer reads) can be skipped because every fragment inplanthat references anExternalRelationis a pure ungroupedAggregatedirectly over that relation, the relation'ssourceMetadataalready contains complete (non-partial) statistics, and the fragment's aggregate functions are metadata-pushable for that source's format reader (i.e.AggregatePushdownSupport.canPushAggregates(java.util.List<org.elasticsearch.xpack.esql.core.expression.Expression>, java.util.List<org.elasticsearch.xpack.esql.core.expression.Expression>)returnsYES).When eligible, the local physical optimizer uses
sourceMetadatastatistics to evaluate the aggregates (COUNT/MIN/MAX) without reading any data files. Skipping discovery for non-pushable aggregates (e.g.SUM,AVG) would force the data node to fall back to a single-path read with no slice queue, which is typically less parallel than per-row-group splits — hence the explicit pushability check.This method is conservative: if the registry has no reader for the source type, if any fragment containing an
ExternalRelationdoes not match theAggregate -> ExternalRelationshape, or if any required statistic is missing, it returnsfalseso that normal split discovery proceeds. -
execute
public void execute(String sessionId, CancellableTask rootTask, EsqlFlags flags, PhysicalPlan physicalPlan, Configuration configuration, FoldContext foldContext, EsqlExecutionInfo execInfo, PlanTimeProfile planTimeProfile, ActionListener<Result> listener) -
executePlan
public void executePlan(String sessionId, CancellableTask rootTask, EsqlFlags flags, PhysicalPlan physicalPlan, Configuration configuration, FoldContext foldContext, EsqlExecutionInfo execInfo, String profileQualifier, ActionListener<Result> listener, Supplier<ExchangeSink> exchangeSinkSupplier, Map<String, EsqlExecutionInfo.Cluster.Status> initialClusterStatuses, PlanTimeProfile planTimeProfile) -
reductionPlan
public static ReductionPlan reductionPlan(PlannerSettings plannerSettings, EsqlFlags flags, Configuration configuration, FoldContext foldCtx, ExchangeSinkExec originalPlan, boolean runNodeLevelReduction, boolean reduceNodeLateMaterialization, PlanTimeProfile planTimeProfile) -
createFlags
-