feat(planner): Improve TextRenderer to show input totals#27189
Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom Feb 24, 2026
Merged
feat(planner): Improve TextRenderer to show input totals#27189tdcmeehan merged 1 commit intoprestodb:masterfrom
tdcmeehan merged 1 commit intoprestodb:masterfrom
Conversation
This makes it much easier to gork what a nodes input were (especially for join nodes)
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideExtends operator input statistics to track total input data size in bytes and updates the text plan renderer to display per-operator input totals (rows and size) alongside averages and standard deviations in EXPLAIN ANALYZE output, wiring the new metric through the plan stats summarization pipeline. Sequence diagram for EXPLAIN ANALYZE input totals propagationsequenceDiagram
actor User
participant PrestoClient
participant Coordinator
participant TaskStats
participant PlanNodeStatsSummarizer
participant PlanNodeStats
participant TextRenderer
User->>PrestoClient: Run EXPLAIN_ANALYZE query
PrestoClient->>Coordinator: Submit query
Coordinator->>TaskStats: Collect operator level stats
TaskStats-->>Coordinator: OperatorStats (including inputDataSizeInBytes)
Coordinator->>PlanNodeStatsSummarizer: getPlanNodeStats(taskStats)
PlanNodeStatsSummarizer->>PlanNodeStatsSummarizer: Build OperatorInputStats
PlanNodeStatsSummarizer->>PlanNodeStats: Create per plan node stats
PlanNodeStats-->>Coordinator: PlanNodeStats list
Coordinator->>TextRenderer: Render textual plan
TextRenderer->>PlanNodeStats: getOperatorInputStats()
TextRenderer->>PlanNodeStats: getOperatorInputPositionsAverages()
TextRenderer->>PlanNodeStats: getOperatorInputPositionsStdDevs()
TextRenderer->>TextRenderer: For each operator
TextRenderer-->>PrestoClient: Text plan with Input total rows and bytes
PrestoClient-->>User: Display plan output
Class diagram for updated operator input statistics and text renderingclassDiagram
class OperatorStats {
+long getTotalDrivers()
+long getInputPositions()
+long getInputDataSizeInBytes()
+double getSumSquaredInputPositions()
}
class OperatorInputStats {
-long totalDrivers
-long inputPositions
-long inputDataSizeInBytes
-double sumSquaredInputPositions
+OperatorInputStats(long totalDrivers, long inputPositions, long inputDataSizeInBytes, double sumSquaredInputPositions)
+long getTotalDrivers()
+long getInputPositions()
+long getInputDataSizeInBytes()
+double getSumSquaredInputPositions()
+static OperatorInputStats merge(OperatorInputStats first, OperatorInputStats second)
}
class PlanNodeStats {
+Map~String, Double~ getOperatorInputPositionsAverages()
+Map~String, Double~ getOperatorInputPositionsStdDevs()
+Map~String, OperatorInputStats~ getOperatorInputStats()
}
class PlanNodeStatsSummarizer {
+static List~PlanNodeStats~ getPlanNodeStats(TaskStats taskStats)
}
class TextRenderer {
-void printDistributions(StringBuilder output, PlanNodeStats stats)
}
class TaskStats {
+List~OperatorStats~ getOperatorSummaries()
}
OperatorStats --> OperatorInputStats : builds
TaskStats --> PlanNodeStatsSummarizer : input
PlanNodeStatsSummarizer --> PlanNodeStats : produces
PlanNodeStatsSummarizer --> OperatorInputStats : aggregates
PlanNodeStats --> OperatorInputStats : exposes via map
TextRenderer --> PlanNodeStats : reads stats
TextRenderer --> OperatorInputStats : reads inputPositions
TextRenderer --> OperatorInputStats : reads inputDataSizeInBytes
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
TextRenderer.printDistributions,inputStats.get(operator)is used without a null check; consider handling the case where input stats might be absent for an operator to avoid potential NPEs. - The computation of
std.dev.assumesinputAverage > 0; guard against zero or extremely smallinputAverageto avoid division-by-zero and unintuitiveInfinity/NaNoutput.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `TextRenderer.printDistributions`, `inputStats.get(operator)` is used without a null check; consider handling the case where input stats might be absent for an operator to avoid potential NPEs.
- The computation of `std.dev.` assumes `inputAverage > 0`; guard against zero or extremely small `inputAverage` to avoid division-by-zero and unintuitive `Infinity`/`NaN` output.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
steveburnett
approved these changes
Feb 23, 2026
Contributor
steveburnett
left a comment
There was a problem hiding this comment.
LGTM! (docs)
Pull updated branch, new local doc build, looks good. Thanks!
tdcmeehan
approved these changes
Feb 24, 2026
This was referenced Mar 31, 2026
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description, Motivation and Context
This makes it much easier to gork what a nodes input were (especially for join nodes)
An example -
Test Plan
CI
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.
Summary by Sourcery
Enhance plan text rendering to include total input row counts and data sizes alongside existing input distribution statistics for operators in EXPLAIN ANALYZE output.
New Features: