Skip to content

expr: Don't propagate an operand's error through non-strict AND/OR in reduce#37049

Open
def- wants to merge 1 commit into
MaterializeInc:mainfrom
def-:fuzz-expr-and-or-errors
Open

expr: Don't propagate an operand's error through non-strict AND/OR in reduce#37049
def- wants to merge 1 commit into
MaterializeInc:mainfrom
def-:fuzz-expr-and-or-errors

Conversation

@def-

@def- def- commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The generic variadic fold in reduce replaced a call with any operand's literal error unconditionally. That is wrong for a non-strict function: AND/OR have a dominating operand (false/true) that absorbs an erroring operand at runtime, so false AND <error> evaluates to false, not an error. Folding col AND <error> to the error made reduce introduce an error into a query that evaluates successfully — a correctness bug. Guard error-propagation with func.propagates_nulls(), mirroring the adjacent null-propagation guard (the other non-strict variadic, Coalesce, already bails out earlier). Found by the mir_scalar_reduce fuzz target.

Split out from #36987

… reduce

The generic variadic fold in `reduce` replaced a call with any operand's literal
error unconditionally. That is wrong for a non-strict function: AND/OR have a
dominating operand (`false`/`true`) that absorbs an erroring operand at runtime,
so `false AND <error>` evaluates to `false`, not an error. Folding
`col AND <error>` to the error made `reduce` introduce an error into a query
that evaluates successfully — a correctness bug. Guard error-propagation with
`func.propagates_nulls()`, mirroring the adjacent null-propagation guard (the
other non-strict variadic, Coalesce, already bails out earlier). Found by the
mir_scalar_reduce fuzz target.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@def- def- requested a review from a team as a code owner June 15, 2026 17:24
@def- def- requested a review from ggevay June 15, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant