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
{{ message }}
Repository navigation
Support Arrays for the Map scalar functions #11436
Is your feature request related to a problem or challenge?
As @alamb mentioned in #11361 (comment), we should support not only scalar lists but also arrays for the map and make_map functions. However, I encountered some challenges, which I detailed in #11361 (comment). I left the disabled test cases in
Sharing my observation from DuckDB, both Map exprssion and map function are meant to do two different things.
But in Datafusion we are using map function to support Map expression.
In case of DuckDBMap expr & map function would yeild different result for same input.
Shouldn't we have two different function to support these two use cases ? Or any ideas on how should we support both usecases using using single map function.
In the meantime i will continue my investigation.
The helper function which i have implemented in #11713 is to support arrays for map scalar function as per issue title.
I am considering introducing a boolean flag to differentiate whether the function was invoked from a Map expression or a map function call. And handle the invocation accordingly
Shouldn't we have two different function to support these two use cases ? Or any ideas on how should we support both usecases using using single map functio
In general, I think DataFuion strives not to invent / determine semantics, so in my opinion we should follow other implementations rather than having our own custom behavior whenever possible.
I think by default we should follow the postgres model
If postgres doesn't support maps / this syntax then I think we should follow the DuckDB model
@dharanad I think select Map {col4: col5} from t; is equivalent to SELECT MAP([col4], [col5]);, so we just need to rewrite the syntax to the existing map function.
Shouldn't we have two different function to support these two use cases ? Or any ideas on how should we support both usecases using using single map functio
In general, I think DataFuion strives not to invent / determine semantics, so in my opinion we should follow other implementations rather than having our own custom behavior whenever possible.
I think by default we should follow the postgres model
If postgres doesn't support maps / this syntax then I think we should follow the DuckDB model
@dharanad I think select Map {col4: col5} from t; is equivalent to SELECT MAP([col4], [col5]);, so we just need to rewrite the syntax to the existing map function.
Thanks for clarifying, i will have to say that i totally misunderstood the problem here. Should have checked what Postgres/DuckDB were doing & clarified the problem.
Activity
dharanad commentedon Jul 12, 2024
take
jayzhan211 commentedon Jul 13, 2024
MakeMap is possible to be removed after #11434, so you can find out array support for
MapFunconlydharanad commentedon Jul 27, 2024
Apologies for the delay, prioritizing this issue.
dharanad commentedon Aug 7, 2024
Sharing my observation from
DuckDB, bothMapexprssion andmapfunction are meant to do two different things.But in Datafusion we are using
mapfunction to supportMapexpression.In case of
DuckDBMapexpr &mapfunction would yeild different result for same input.Shouldn't we have two different function to support these two use cases ? Or any ideas on how should we support both usecases using using single
mapfunction.Observations
In the meantime i will continue my investigation.The helper function which i have implemented in #11713 is to support arrays for
mapscalar function as per issue title.I am considering introducing a boolean flag to differentiate whether the function was invoked from a Map expression or a map function call. And handle the invocation accordingly
cc: @goldmedal @jayzhan211
alamb commentedon Aug 8, 2024
In general, I think DataFuion strives not to invent / determine semantics, so in my opinion we should follow other implementations rather than having our own custom behavior whenever possible.
I think by default we should follow the postgres model
If postgres doesn't support maps / this syntax then I think we should follow the DuckDB model
jayzhan211 commentedon Aug 8, 2024
@dharanad I think
select Map {col4: col5} from t;is equivalent toSELECT MAP([col4], [col5]);, so we just need to rewrite the syntax to the existing map function.dharanad commentedon Aug 9, 2024
I totally agree with you.
dharanad commentedon Aug 9, 2024
Thanks for clarifying, i will have to say that i totally misunderstood the problem here. Should have checked what Postgres/DuckDB were doing & clarified the problem.