Emit physical_plan and data_node_metrics for LATE_MATERIALIZATION profile - #22676
Emit physical_plan and data_node_metrics for LATE_MATERIALIZATION profile#22676finnegancarroll wants to merge 3 commits into
Conversation
PR Reviewer Guide 🔍(Review updated until commit 896a17c)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 896a17c Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 96a9fa4
Suggestions up to commit 0f71d04
Suggestions up to commit 19a8d72
Suggestions up to commit 3714eb7
|
3714eb7 to
19a8d72
Compare
|
Persistent review updated to latest commit 19a8d72 |
…file The profile API (profile=true) returns rich per-task diagnostics for SHARD_FRAGMENT and COORDINATOR_REDUCE stages but nothing for LATE_MATERIALIZATION. This change wires the fetch-by-row-ids path to return physical_plan and data_node_metrics when profiling is enabled. Rust: - Pass the DataFusion physical plan to the stream handle in fetch_by_row_ids so get_metrics_json() can walk the plan tree. Java: - Add profile flag to FetchByRowIdsRequest (serialized on the wire). - Extract execution metrics in drainFetchByRowIds when profile=true. - Store trailing metrics on the LM stage task via onStreamComplete. Resolves opensearch-project#22601 (items 1 and 2) Signed-off-by: Finnegan Carroll <carrofin@amazon.com> Signed-off-by: Finn Carroll <carrofin@amazon.com>
19a8d72 to
0f71d04
Compare
|
Persistent review updated to latest commit 0f71d04 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22676 +/- ##
============================================
+ Coverage 71.52% 71.53% +0.01%
- Complexity 77023 77041 +18
============================================
Files 6156 6156
Lines 358422 358422
Branches 52245 52245
============================================
+ Hits 256351 256396 +45
+ Misses 81694 81665 -29
+ Partials 20377 20361 -16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Finnegan Carroll <carrofin@amazon.com> Signed-off-by: Finn Carroll <carrofin@amazon.com>
|
Persistent review updated to latest commit 96a9fa4 |
|
❌ Gradle check result for 96a9fa4: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
… gradle-check Jenkins failure with no test details) Signed-off-by: Finn Carroll <carrofin@amazon.com>
|
Persistent review updated to latest commit 896a17c |
|
❌ Gradle check result for 896a17c: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Summary
profile=truereturns rich per-task diagnostics (physical_plan, data_node_metrics) for SHARD_FRAGMENT and COORDINATOR_REDUCE stages but nothing for LATE_MATERIALIZATION. When the LM stage dominates wall clock, the profile gives no information about why.This change wires the fetch-by-row-ids path to return both fields when profiling is enabled.
Changes
Rust (
analytics-backend-datafusion/rust/src/):api.rs: Clone the DataFusion physical plan beforeexecute_streamand pass it to the stream handle via a newwrap_stream_as_handle_with_plan()helper.query_executor.rs: Newwrap_stream_as_handle_with_plan()that attaches an optional physical plan to theQueryStreamHandle, enablingget_metrics_json()to walk the plan tree.Java (
analytics-engine/):FetchByRowIdsRequest: Addprofileboolean field (wire-serialized).AnalyticsSearchService.drainFetchByRowIds(): Extract execution metrics after stream exhaustion whenrequest.profile()is true; send viaonCompleteWithMetrics()sentinel.LateMaterializationStageExecution: Passconfig.profile()when constructing fetch requests; implementonStreamComplete()onGatherListenerto store trailing metrics on the stage task.Integration Test:
LateMaterializationProfileIT: Asserts LM stage tasks returndata_node_metricsandphysical_plancontainingParquetExec.Testing
Resolves #22601 (items 1 and 2)