-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shall we implement higher order function map
(Presto Transform
)?
#11123
Comments
Transform
?map
(Presto Transform
)?
What if we don't know the dimension in advance? I suppose we cannot determine how many times |
It is part of the static type. |
I missed this issue and write a RFC today for the higher order function risingwavelabs/rfcs#69 |
It's fine, I was thinking the same:
I remember Xiangjin told me that the lambda expression here is more restrictive, i.e. it must be a const function |
Let me clarify this, supporting lambda expression and higher order function are two different things, although related. It is possible to use higher order function (
Lambda expression just makes the use of HOF more convenient, so that we do not need to The core part of HOP support is how to pass functions (incl lambda) as arguments. Right now By saying the argument (possible a function) must be const, I mean it cannot be a column (InputRef) as follows:
(To be honest, the |
This refers to the
transform
function in PrestoDB:https://prestodb.io/docs/current/functions/array.html#transformThe way Risingwave currently write is:
If I do:
And in PG:
Current workaround is to use subquery / CTE / view:
But writing
Transform(my_array, x -> x * 2)
is much more concise.Also note the unnest + array_agg trick above only works for 1d array, because unnest in PostgreSQL works recursively. We would need a non-recursive
unnest_list
to pair witharray_agg
precisely if such usage become more common.This case is inspired by users' query of Presto, but the user's usage can be worked around as it essentially is a
xxx in (A, B, C)
Link risingwavelabs/rfcs#69
The text was updated successfully, but these errors were encountered: