jayzhan211 commented on code in PR #6796:
URL: https://github.com/apache/arrow-datafusion/pull/6796#discussion_r1278474676


##########
datafusion/core/tests/sqllogictests/test_files/array.slt:
##########
@@ -1794,9 +1802,150 @@ select make_array(f0) from fixed_size_list_array
 ----
 [[1, 2], [3, 4]]
 
+## Unnest
 
-### Delete tables
+# Set target partitions to 1 for deterministic results
+statement ok
+set datafusion.execution.target_partitions = 1;
+
+query ??
+select unnest(make_array(1,2,3)),
+       unnest(make_array(4,5))
+;
+----
+1 4
+2 5
+3 NULL
+
+query ???
+select unnest(make_array(1,2,3)),
+       unnest(make_array(4,5)),
+       unnest(make_array(6,7,8,9))
+;
+----
+1 4 6
+2 5 7
+3 NULL 8
+NULL NULL 9
+
+query ???
+select unnest(make_array(1,2,3,4,5)),
+       unnest(make_array(6,7)),
+       unnest(make_array(8,9,10,11,22,33))
+;
+----
+1 6 8
+2 7 9
+3 NULL 10
+4 NULL 11
+5 NULL 22
+NULL NULL 33
+
+# Select From
+
+query IIIII
+select * from unnest(
+  make_array(1), 
+  make_array(2,3), 
+  make_array(4,5,6),
+  make_array(7,8),
+  make_array(9)
+);
+----

Review Comment:
   I agree this syntax is better if we like partial unnest, e.g. `select 
unnest(a), b, unnest(c) from table`.
   Clickhouse has a similar syntax 
https://clickhouse.com/docs/en/sql-reference/functions/array-join.
   
   `select * from unnest()` is equivalent to `select 
unnest(a),unnest(b),unnest(c) from table` but with simplified syntax, so I 
think keeping it is also nice.
   https://www.postgresql.org/docs/current/functions-array.html
   



-- 
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]

Reply via email to