You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a LambdaPhysicalExpr that holds the lambda physical expr and returns ScalarValue::Null in PhysicalExpr::evaluate or an error
Open question: Define a way to a ScalarUDFImpl declare the types of the args of all lambda functions it receives, so a input schema can be built and used to generated the LambdaPhysicalExpr
And then, one of:
Make ScalarFunctionArgs generic over the arg type, with ColumnarValue as default, and add a new ScalarUDF method invoke_with_lambda_args / invoke_higher_order_with_args that receives ScalarFunctionArgs<ColumnarValueOrLambda> instead of ScalarFunctionArgs, and has a default implementation calling invoke_with_args, returning an error if any arg is an lambda. The lambda arg is created if any children PhysicalExpr is a LambdaPhysicalExpr
Add physical_exprs: Vec<Arc<dyn PhysicalExpr>> to ScalarFunctionArgs, so lambda expressions can be extracted from
Add LambdaScalarUDF trait (Duplication with ScalarUDF, more work and more code to mantain, less flexible than 1, one more trait to document and to users to reason about)
Change ScalarFunctionArgs.args to Vec<ColumnarValueOrLambda> instead of Vec<ColumnarValue> (A lot of breakage, including public)
Add Lambda variant to ColumnarValue (Even more breakge than 2, and a lambda doesn't quite fit the concept of a columnar value)
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem or challenge?
Some engines, like DuckDB and Clickhouse, supports lambda functions, like:
There's already support for the syntax in sqlparser-rs
From #12206 (comment) by @jayzhan211
Describe the solution you'd like
One of
Expr::Lambda{arg_names: Vec<String>, expr: Expr}
variantScalarFunction.args
:Create a
LambdaPhysicalExpr
that holds the lambda physical expr and returns ScalarValue::Null inPhysicalExpr::evaluate
or an errorOpen question: Define a way to a
ScalarUDFImpl
declare the types of the args of all lambda functions it receives, so a input schema can be built and used to generated theLambdaPhysicalExpr
And then, one of:
ScalarFunctionArgs
generic over the arg type, withColumnarValue
as default, and add a newScalarUDF
methodinvoke_with_lambda_args
/invoke_higher_order_with_args
that receivesScalarFunctionArgs<ColumnarValueOrLambda>
instead ofScalarFunctionArgs
, and has a default implementation callinginvoke_with_args
, returning an error if any arg is an lambda. The lambda arg is created if any childrenPhysicalExpr
is aLambdaPhysicalExpr
physical_exprs: Vec<Arc<dyn PhysicalExpr>>
toScalarFunctionArgs
, so lambda expressions can be extracted fromLambdaScalarUDF
trait (Duplication withScalarUDF
, more work and more code to mantain, less flexible than 1, one more trait to document and to users to reason about)ScalarFunctionArgs.args
toVec<ColumnarValueOrLambda>
instead ofVec<ColumnarValue>
(A lot of breakage, including public)Lambda
variant toColumnarValue
(Even more breakge than 2, and a lambda doesn't quite fit the concept of a columnar value)Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: