Skip to content

Consider PreSelection short-circuit strategy for OR #22342

Description

@neilconway

Is your feature request related to a problem or challenge?

BinaryExpr already implements row-level short-circuit for AND via ShortCircuitStrategy::PreSelection (#15462): when the LHS of an AND is mostly false (≤20% true), the RHS evaluates only on the rows that survived LHS, not on the full batch.

The dual case for OR is not implemented. Today, OR only short-circuits when LHS is entirely true (ReturnLeft) or entirely false (ReturnRight#15636). For partially-true LHS, the RHS still evaluates on the full batch, even though the rows where LHS is already true can never have their OR result change.

This leaves a symmetric optimization on the table: when LHS of an OR is mostly true on a batch, RHS only needs to evaluate on the rows where LHS was false.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions