fix(planner): Fix size estimate used in TextRenderer#27080
Merged
aaneja merged 1 commit intoprestodb:masterfrom Feb 17, 2026
Merged
fix(planner): Fix size estimate used in TextRenderer#27080aaneja merged 1 commit intoprestodb:masterfrom
aaneja merged 1 commit intoprestodb:masterfrom
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes text plan size estimation by introducing a NodeRepresentation-based output size helper in PlanNodeStatsEstimate and using it in TextRenderer instead of the plan root, so estimates reflect each node’s own outputs. Sequence diagram for size estimation in TextRenderer printEstimatessequenceDiagram
participant TR as TextRenderer
participant PR as PlanRepresentation
participant NR as NodeRepresentation
participant SE as PlanNodeStatsEstimate
TR->>PR: getPlanNodeRoot()
PR-->>TR: PlanNode (unused for size in new behavior)
TR->>SE: getSourceInfo()
SE-->>TR: SourceInfo
TR->>SE: getOutputSizeInBytes(NR)
alt sizeUsingVariables is false and totalSize is not NaN
SE-->>TR: totalSize
else sizeUsingVariables is true or totalSize is NaN
SE->>NR: getOutputs()
NR-->>SE: List outputs
SE->>SE: getOutputSizeForVariables(outputs)
SE-->>TR: computedSize
end
TR->>TR: formatEstimateAsDataSize(size)
TR-->>TR: include size in printed estimates
Class diagram for updated PlanNodeStatsEstimate and TextRenderer interactionclassDiagram
class PlanNodeStatsEstimate {
- SourceInfo sourceInfo
- double totalSize
+ double getOutputSizeInBytes(PlanNode planNode)
+ double getOutputSizeInBytes(NodeRepresentation nodeRepresentation)
- double getOutputSizeForVariables(List~VariableReferenceExpression~ variables)
+ SourceInfo getSourceInfo()
}
class SourceInfo {
+ boolean estimateSizeUsingVariables()
}
class PlanNode {
+ List~VariableReferenceExpression~ getOutputVariables()
}
class NodeRepresentation {
+ List~VariableReferenceExpression~ getOutputs()
}
class TextRenderer {
- String printEstimates(PlanRepresentation plan, NodeRepresentation node)
}
class PlanRepresentation {
+ PlanNode getPlanNodeRoot()
}
class VariableReferenceExpression
TextRenderer ..> PlanNodeStatsEstimate : uses
TextRenderer ..> PlanRepresentation : uses
TextRenderer ..> NodeRepresentation : uses
PlanNodeStatsEstimate ..> SourceInfo : uses
PlanNodeStatsEstimate ..> PlanNode : uses
PlanNodeStatsEstimate ..> NodeRepresentation : uses
PlanNodeStatsEstimate ..> VariableReferenceExpression : uses
PlanRepresentation --> PlanNode : root
PlanNode --> VariableReferenceExpression : outputVariables
NodeRepresentation --> VariableReferenceExpression : outputs
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
ed1e04d to
e3dce8a
Compare
e3dce8a to
355e507
Compare
tdcmeehan
approved these changes
Feb 13, 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
The size estimate on text plans (EXPLAIN plans e.g) was incorrectly changed to use the plan root instead of the actual node's outputs in 7f5f219
We fix this bug
Test Plan
CI + new test to assert on
Estimatesstrings in the text planContributor checklist
Release Notes
Summary by Sourcery
Correct the size estimate used when rendering text query plans to rely on each node's own outputs instead of the plan root.
Bug Fixes:
Enhancements:
Summary by Sourcery
Correct size estimation used when rendering textual query plans so estimates are based on each node representation rather than the plan root.
Bug Fixes:
Enhancements: