fix(isthmus)!: preserve UPDATE predicates - #1259
Draft
bvolpato wants to merge 2 commits into
Draft
Conversation
Resolve predicates and assignments through projection/filter inputs back to columns of the target table. Reject input pipelines that cannot be preserved by a zero-input UpdateRel. BREAKING CHANGE: UPDATE conversion rejects unsupported row-selection operators, window projections, and removed correlation binding points instead of emitting an update with different selection semantics.
Inlining a projected nondeterministic value can evaluate it more than once, and composing multiple filters can deduplicate repeated volatile predicates. Reject those input shapes when their evaluation boundaries cannot be represented by UpdateRel. Inspect nested subquery plans and their aggregate and window operators for nondeterminism. Convert a single filter condition directly so repeated volatile calls inside it remain distinct. Cover projected RAND values, multiple RAND filters, and single-filter conversion with a custom function mapper.
bvolpato
force-pushed
the
bvolpato/fix-update-predicate
branch
from
September 4, 2026 16:15
c9b3d1c to
43057b4
Compare
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.
Calcite represents a normal SQL UPDATE as a projection over the WHERE filter. Checking only the immediate input therefore replaces the predicate with TRUE. For example:
The converted update currently targets every row. Walk the projection/filter chain, express both predicates and assignments in target-table coordinates, and retain every selection condition. This also handles predicates above projections and assignments containing projected references inside larger expressions.
Downsides
Flattening cannot preserve every Calcite input pipeline in Substrait's zero-input UpdateRel. Conversion rejects unsupported row-selection operators, window or nondeterministic projections, multiple filters with nondeterministic predicates, and removed correlation binding points instead of emitting a different update. Independent subqueries remain supported when their evaluation can be preserved, and the determinism check includes expressions inside subqueries. A single filter condition keeps its original expression so repeated volatile calls are not deduplicated.
BREAKING CHANGE: UPDATE conversion now throws UnsupportedOperationException for input pipelines it cannot preserve. Callers must handle the unsupported conversion instead of relying on the previous output, which could discard selection conditions, retain unresolved outer references, or change how often nondeterministic expressions run.