comphead commented on PR #18921:
URL: https://github.com/apache/datafusion/pull/18921#issuecomment-3930657951
Thanks @gstvg for driving this. I missed this PR and actually was advocating
for lambda support in DataFusion roadmap. Let me explore this approach, in high
level IMO it makes sense to introduce LambdaUDF trait so taking as example
`SELECT list_filter([1,2,3,4], x -> x % 2 = 0);` it could look like
```
FunctionExpression
name: list_filter
children:
1. ListExpression [1,2,3,4]
2. LambdaExpression
parameters: ["x"]
body:
ComparisonExpression (=)
left:
ArithmeticExpression (%)
left: ColumnRef("x")
right: Constant(2)
right:
Constant(0)
```
Then we likely need to Bind `x` to know what is it and finally rewrite it
into something computable, perhaps using UDF of (Int) => Boolean and provide a
bitmap as the result of valid indices and then extract valid indices from
array. It might preserve SIMD execution.
It is great to see this effort is moving
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]