Skip to content

Conversation

pepijnve
Copy link
Contributor

@pepijnve pepijnve commented Oct 9, 2025

Which issue does this PR close?

Rationale for this change

This PR provides an alternative mechanism for scalar UDFs to control argument evaluation besides rewriting to other constructs like case.

What changes are included in this PR?

  • Add ScalarUDF::invoke_with_deferred_arguments
  • Adapt ScalarFunctionExpr to use this mechanism when the function is declared to be short circuiting.
  • Provide an initial implementation using this mechanism for nvl.

Are these changes tested?

Covered by SQL logic tests

Are there any user-facing changes?

The new mechanism doesn't change anything. For nvl specifically, argument evaluation changes from eager to lazy.

@pepijnve pepijnve marked this pull request as draft October 9, 2025 13:50
@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates optimizer Optimizer rules common Related to common crate functions Changes to functions implementation labels Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate functions Changes to functions implementation logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable lazy argument evaluation for arbitrary scalar functions

1 participant