Add explain to AnalyticsExecutionEngine#5442
Conversation
PR Reviewer Guide 🔍(Review updated until commit e613538)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to e613538 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit c73e747
Suggestions up to commit c73e747
Suggestions up to commit f6de314
|
f6de314 to
c73e747
Compare
|
Persistent review updated to latest commit c73e747 |
|
Persistent review updated to latest commit c73e747 |
…thProfile AnalyticsExecutionEngine.explain() now calls executeWithProfile on the analytics engine's QueryPlanExecutor, executing the query and capturing per-stage timing from the coordinator's perspective. The resulting QueryProfile is attached to ExplainResponseNodeV2 and serialized in the /_plugins/_ppl/_explain response. Changes: - ExplainResponseNodeV2: add QueryProfile field with backward-compatible 3-arg constructor - ExplainResponse.normalizeLf(): preserve profile field when normalizing line endings - AnalyticsExecutionEngine.explain(): call executeWithProfile, attach profile to response. Falls back to plan-only on failure. Signed-off-by: Finn Carroll <carrofin@amazon.com>
c73e747 to
e613538
Compare
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit e613538.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
|
Persistent review updated to latest commit e613538 |
Description
Connects SQL plugin
AnalyticsExecutionEngineexplain API with analytics engineexecuteWithProfilepath. Providing per execution stage profiling for queries executed on this endpoint.Note that
_explainAPI on a an analytics engine index will provide the logical plan, execute the query, and provide profiling information for each execution stage. In contrast non analytics engine indices will only return the logical plan.Testing
1. Publish SQL Plugin to Maven Local
2. Start Single-Node Cluster
3. Create Parquet-Backed Index
4. Ingest Sample Data
5. Run Explain Query (SQL Plugin Path)
Result
{ "calcite": { "logical": "LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(avg(score)=[$1], name=[$0])\n LogicalAggregate(group=[{0}], avg(score)=[AVG($1)])\n LogicalProject(name=[$1], score=[$2])\n LogicalTableScan(table=[[opensearch, test_parquet]])\n", "profile": { "queryId": "8ffee8b8-944b-4fcd-9f71-6f4601f8034b", "fullPlan": [ "OpenSearchSort(fetch=[10000], viableBackends=[[datafusion]])", " OpenSearchProject(avg(score)=[$1], name=[$0], viableBackends=[[datafusion]])", " OpenSearchProject(name=[$0], avg(score)=[ANNOTATED_PROJECT_EXPR(id=2, backends=[datafusion], /($1, $2))], viableBackends=[[datafusion]])", " OpenSearchAggregate(group=[{0}], agg#0=[SUM(...)], agg#1=[COUNT(...)], mode=[FINAL], viableBackends=[[datafusion]])", " OpenSearchExchangeReducer(viableBackends=[[datafusion]])", " OpenSearchAggregate(group=[{0}], agg#0=[SUM(...)], agg#1=[COUNT(...)], mode=[PARTIAL], viableBackends=[[datafusion]])", " OpenSearchProject(name=[$1], score=[$2], viableBackends=[[datafusion]])", " OpenSearchTableScan(table=[[test_parquet]], viableBackends=[[datafusion]])" ], "totalElapsedMs": 220, "stages": [ { "stageId": 0, "executionType": "SHARD_FRAGMENT", "distribution": "SINGLETON", "state": "SUCCEEDED", "elapsedMs": 217, "rowsProcessed": 3, "tasksCompleted": 2, "tasksFailed": 0, "fragment": [ "OpenSearchAggregate(..., mode=[PARTIAL], ...)", " OpenSearchProject(name=[$1], score=[$2], ...)", " OpenSearchTableScan(table=[[test_parquet]], ...)" ], "tasks": [ { "partitionId": 0, "node": "953slSrWQiaMqNimQGKTfg/shard[0]", "state": "FINISHED", "elapsedMs": 216 }, { "partitionId": 1, "node": "953slSrWQiaMqNimQGKTfg/shard[1]", "state": "FINISHED", "elapsedMs": 206 } ] }, { "stageId": 1, "executionType": "COORDINATOR_REDUCE", "state": "SUCCEEDED", "elapsedMs": 3, "rowsProcessed": 0, "tasksCompleted": 0, "tasksFailed": 0, "fragment": [ "OpenSearchSort(fetch=[10000], ...)", " OpenSearchProject(avg(score)=[$1], name=[$0], ...)", " OpenSearchAggregate(..., mode=[FINAL], ...)", " OpenSearchExchangeReducer(...)", " OpenSearchStageInputScan(childStageId=[0], ...)" ], "tasks": [] } ] } } }Related Issues
N/A
Check List
- [ ] New functionality includes testing.<- Tested locally, no IT suite for analytics plugin at this time--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.