facebookincubator / velox

A C++ vectorized database acceleration library aimed to optimizing query engines and data processing systems.
https://velox-lib.io/
Apache License 2.0
3.47k stars 1.14k forks source link

Support for complex types as key into multimap_agg #7097

Open ashokku2022 opened 1 year ago

ashokku2022 commented 1 year ago

Description

Currently, we don't support complex types (ARRAY/ROW/MAP) as key input into multimap_agg aggregation function. The same is being accepted by Presto. We need to implement accepting complex types as key into multimap_agg.

presto:tpch> select multimap_agg(x,y) from (values (array[1,2], 1), (array[1,2], 2)) AS tbl(x,y);
Query 20231016_065749_00031_ns577 failed:  Aggregate function signature is not supported: presto.default.multimap_agg(ARRAY<INTEGER>, INTEGER). Supported signatures: (boolean,V) -> map(boolean,array(V)) -> map(boolean,array(V)), (tinyint,V) -> map(tinyint,array(V)) -> map(tinyint,array(V)), (smallint,V) -> map(smallint,array(V)) -> 
map(smallint,array(V)), (integer,V) -> map(integer,array(V)) -> map(integer,array(V)), (bigint,V) -> map(bigint,array(V)) -> map(bigint,array(V)), (real,V) -> map(real,array(V)) -> map(real,array(V)), (double,V) -> map(double,array(V)) -> 
map(double,array(V)), (timestamp,V) -> map(timestamp,array(V)) -> map(timestamp,array(V)), (date,V) -> map(date,array(V)) -> map(date,array(V)), (varbinary,V) -> map(varbinary,array(V)) -> map(varbinary,array(V)), (varchar,V) -> map(varchar,array(V)) -> map(varchar,array(V)), (unknown,V) -> map(unknown,array(V)) -> map(unknown,array(V)).

@Krishna-Prasad-P-V requested to open this issue and is going to work on it. @mbasmanova @aditi-pandit

aditi-pandit commented 1 year ago

@Krishna-Prasad-P-V : Please can do a detailed writeup on the semantics of such functions and how you intend to implement it. It would be good to review your design before any code.