Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,45 @@
import static org.elasticsearch.xpack.esql.plugin.EsqlPlugin.ESQL_WORKER_THREAD_POOL_NAME;

/**
* Computes the result of a {@link PhysicalPlan}.
* Once query is parsed and validated it is scheduled for execution by {@code 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 {@code 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 {@code org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#startComputeOnDataNodes}
* that is responsible for
* <ul>
* <li>
* Determining list of nodes that contain shards referenced by the query with
* {@code org.elasticsearch.xpack.esql.plugin.DataNodeRequestSender#searchShards}
* </li>
* <li>
* Each node in the list processed in
* {@code org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#startComputeOnDataNodes}
* in order to
* <ul>
* <li>
* 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.
* {@see org.elasticsearch.compute.operator.exchange.ExchangeService#openExchange}
* </li>
* <li>
* Start data node plan execution on the target data node
* using `indices:data/read/esql/data` transport request
* {@see org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#messageReceived}
* {@see org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#runComputeOnDataNode}
* </li>
* <li>
* 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.
* {@see org.elasticsearch.compute.operator.exchange.ExchangeService.ExchangeTransportAction#messageReceived}
* </li>
* </ul>
* </li>
* </ul>
*/
public class ComputeService {
public static final String DATA_ACTION_NAME = EsqlQueryAction.NAME + "/data";
Expand Down