Fix tiered projection for side-effecting AND/OR expressions #17239
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.42) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 328 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.347
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #17239"
general
weight: 0.35
thirtiseven
Fixes #16989.
Description
Repeated side-effecting expressions inside conditional GPU AND/OR operands could be moved into a whole-batch tiered projection. In ANSI mode, this evaluated guarded operations such as division by zero on rows that CPU short-circuiting skips, causing GPU queries to fail instead of matching CPU results.
Global CSE now traverses only actual left-spine prefixes from longest to shortest, preserving top-down traversal semantics without creating extra tiers or synthetic right-associated prefixes. Per-subtree expression profiles are reused, and the unused final safe-right profile is skipped, so long right-associated chains remain linear to plan. Scoped CSE analyzes guarded operands once in a forward pass, records first/last occurrence intervals, merges overlapping regions, and recursively scopes CSE inside generated tiers. This supports non-adjacent repeats, compound operands, interleaved regions, and nested mixed AND/OR expressions while preserving short-circuit evaluation.
There are no new configurations or other user-facing API changes.
Validation:
GpuEquivalentExpressionsSuite: 35/35 on Scala 2.12 and 35/35 on Scala 2.13, including 64-operand right-associated AND and OR chains.Performance was measured on 4 billion synthetic rows across 32 partitions, with one warm-up and three measured iterations per case. Compared with the previously reviewed optimized implementation, all 11 benchmark medians changed by between -1.8% and +1.7%. The most expensive eight-repeat AND and OR cases completed in 4.14 and 4.25 seconds respectively, showing no material regression.
AI assistance was used to implement, review, and validate this change.
Checklists
Documentation
Testing
Performance