fix: Fix update error with pushdownsubfields optimization#27254
Merged
zation99 merged 1 commit intoprestodb:masterfrom Mar 5, 2026
Merged
fix: Fix update error with pushdownsubfields optimization#27254zation99 merged 1 commit intoprestodb:masterfrom
zation99 merged 1 commit intoprestodb:masterfrom
Conversation
Contributor
Reviewer's GuideHandle UPDATE plan nodes in the PushdownSubfields optimizer to avoid verification failures when pushdown-subfields is enabled, and add Iceberg logical planner coverage for DML (UPDATE/DELETE) with subfield pushdown enabled. Sequence diagram for UPDATE planning with PushdownSubfields optimizationsequenceDiagram
actor User
participant Coordinator
participant Planner
participant PushdownSubfields
participant Rewriter
participant UpdateNode
User->>Coordinator: submit UPDATE statement
Coordinator->>Planner: plan UPDATE
Planner->>Planner: build logical plan with UpdateNode
Planner->>PushdownSubfields: optimize(plan, session)
PushdownSubfields->>Rewriter: rewrite(plan, rootContext)
Rewriter->>UpdateNode: visitUpdate(node, context)
UpdateNode-->>Rewriter: getSource()
UpdateNode-->>Rewriter: getSource().getOutputVariables()
Rewriter->>Rewriter: context.variables.addAll(sourceOutputVariables)
Rewriter->>Rewriter: context.defaultRewrite(node, context)
Rewriter-->>PushdownSubfields: optimizedPlan
PushdownSubfields-->>Planner: return optimizedPlan
Planner-->>Coordinator: executable plan
Coordinator-->>User: execute UPDATE successfully
Updated class diagram for PushdownSubfields optimizer handling UpdateNodeclassDiagram
class PushdownSubfields {
+PlanNode optimize(PlanNode plan, Session session, Map planSymbolAllocator)
}
class Context {
+Set~VariableReferenceExpression~ variables
}
class Rewriter {
+PlanNode visitDelete(DeleteNode node, RewriteContext~Context~ context)
+PlanNode visitUpdate(UpdateNode node, RewriteContext~Context~ context)
+PlanNode visitTopN(TopNNode node, RewriteContext~Context~ context)
+PlanNode visitExplainAnalyze(ExplainAnalyzeNode node, RewriteContext~Context~ context)
+PlanNode defaultRewrite(PlanNode node, Context context)
}
class PlanNode {
<<abstract>>
+List~VariableReferenceExpression~ getOutputVariables()
}
class DeleteNode {
+PlanNode getSource()
}
class UpdateNode {
+PlanNode getSource()
+List~VariableReferenceExpression~ getOutputVariables()
}
class TopNNode {
+PlanNode getSource()
}
class ExplainAnalyzeNode {
+PlanNode getSource()
}
class RewriteContext~Context~ {
+Context get()
+PlanNode defaultRewrite(PlanNode node, Context context)
}
PushdownSubfields *-- Rewriter
Rewriter --> RewriteContext~Context~
RewriteContext~Context~ --> Context
PlanNode <|-- DeleteNode
PlanNode <|-- UpdateNode
PlanNode <|-- TopNNode
PlanNode <|-- ExplainAnalyzeNode
Rewriter ..> DeleteNode : visitDelete
Rewriter ..> UpdateNode : visitUpdate
Rewriter ..> TopNNode : visitTopN
Rewriter ..> ExplainAnalyzeNode : visitExplainAnalyze
Rewriter ..> Context : uses
Rewriter ..> PlanNode : rewrites
UpdateNode ..> PlanNode : source
DeleteNode ..> PlanNode : source
TopNNode ..> PlanNode : source
ExplainAnalyzeNode ..> PlanNode : source
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:
- The new
testPushdownSubfieldsWithDmlrelies on the environment’s default forpushdown-subfields-enabled; consider explicitly enabling this session property in the test so it clearly exercises the intended optimizer behavior and doesn’t become a no-op if defaults change. - In
visitUpdate, you only registernode.getSource().getOutputVariables(); if the optimizer relies on seeing all referenced variables, consider whether any update-specific variables (e.g., assignment targets) should also be tracked for consistency with other plan node handlers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `testPushdownSubfieldsWithDml` relies on the environment’s default for `pushdown-subfields-enabled`; consider explicitly enabling this session property in the test so it clearly exercises the intended optimizer behavior and doesn’t become a no-op if defaults change.
- In `visitUpdate`, you only register `node.getSource().getOutputVariables()`; if the optimizer relies on seeing all referenced variables, consider whether any update-specific variables (e.g., assignment targets) should also be tracked for consistency with other plan node handlers.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
0c66ac6 to
e0d698d
Compare
hantangwangd
reviewed
Mar 4, 2026
presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java
Outdated
Show resolved
Hide resolved
e0d698d to
4defdd7
Compare
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
Update with subfields pushdown enabled reports error.
Test Plan
added test for Iceberg connector for update
== NO RELEASE NOTE ==
Summary by Sourcery
Handle UPDATE plans in the PushdownSubfields optimizer and add coverage for DML with subfields pushdown enabled for the Iceberg connector.
Bug Fixes:
Tests: