Skip to content

Enable lazy argument evaluation for arbitrary scalar functions #17992

@pepijnve

Description

@pepijnve

Is your feature request related to a problem or challenge?

If a scalar function currently want to use lazy argument evaluation it needs to implement simplify and rewrite itself into some other PhysicalExpr that implements lazy evaluation. coalesce being rewritten to case is a good example of this.

While this is fine for some situations, it would be more flexible if ScalarUDF implementations could control argument evaluation themselves rather than having to rewrite themselves.

There is a hint of support for this idea already in the form of ScalarUDF#short_circuits.

Describe the solution you'd like

Provide some way to pass arguments whose evaluation is deferred to scalar UDF implementations so that those can control if and when arguments are evaluated.

Describe alternatives you've considered

No response

Additional context

Relates to #17982 and #17983

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions