kuzudb / kuzu

Embeddable property graph database management system built for query speed and scalability. Implements Cypher.
https://kuzudb.com/
MIT License
1.07k stars 77 forks source link

Allow `UNWIND` for `ARRAY` data type #3401

Closed prrao87 closed 2 weeks ago

prrao87 commented 2 weeks ago

In testing the ARRAY data type, it seems like UNWIND doesn't work for it like it does for LIST. We should support UNWIND for ARRAY too, considering it's just a special case of LIST.

kuzu> UNWIND CAST([[5,2,1],[2,3],[15,64,74]], 'INT64[][3]') AS x RETURN x;
Error: Binder exception: CAST(LIST_CREATION(LIST_CREATION(5,2,1),LIST_CREATION(2,3),LIST_CREATION(15,64,74)), INT64[][3]) has data type INT64[][3] but LIST was expected.

For LIST, this works fine:

kuzu> UNWIND [[5,2,1],[2,3],[15,64,74]] AS x RETURN x;
--------------
| x          |
--------------
| [5,2,1]    |
--------------
| [2,3]      |
--------------
| [15,64,74] |
--------------
(3 tuples)
(1 column)
Time: 0.13ms (compiling), 0.24ms (executing)