Repository navigation
fix: evaluate volatile IN operands once - #27448
Merged
mergify[bot] merged 20 commits intoAug 22, 2026
Merged
Conversation
# Conflicts: # pkg/sql/compile/compile.go
XuPeng-SH
approved these changes
Aug 22, 2026
XuPeng-SH
left a comment
Contributor
There was a problem hiding this comment.
Re-reviewed exact HEAD b358960.
The previous P1 is closed: volatile predicates now stay above AGG and the other audited cardinality-changing boundaries, and volatile project substitutions are kept above PROJECT. The original result-plus-currval reproduction now returns the expected count = 0 and currval = 1.
I also ran the focused planner/colexec/compile tests, the embedded volatile-IN regression with additional flattened-subquery and forced-index counterexamples, and the memo executor test under -race (count=10); all passed. CI is green. No blocking findings.
Contributor
Merge Queue Status
This pull request spent 1 hour 4 minutes 45 seconds in the queue, including 1 hour 4 minutes 23 seconds running CI. Required conditions to merge
|
1 of 7 tasks
1 task done
This branch was previously deployed
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.
What type of PR is this?
Which issue(s) this PR fixes:
issue #27088
What this PR does / why we need it:
Mixed-type
INandNOT INpredicates can expand one volatile left operand into multiple comparisons. This PR assigns a shared planner-local memo identity to stable volatile source nodes and evaluates each source once per root expression evaluation. Tuple operands receive independent identities per volatile element without memoizing candidate-specific cast wrappers.It also:
The focused SQL regression covers prepared scalar/tuple
INandNOT IN, direct mixed-type literals, independent volatile occurrences underOR, join fan-out, one-sided join predicates over multi-row fan-out, aggregate cardinality reduction, PROJECT alias substitution, and tuple candidates with different physical cast types. It checks both query results andcurrvalso duplicated, eliminated, prematurely evaluated, or type-confused side effects cannot pass unnoticed.Validation:
pkg/sql/colexec,pkg/sql/compile,pkg/sql/plan, andpkg/tests/issuestest suites