@@ -346,8 +346,8 @@ AS VALUES
346346 (arrow_cast(make_array([[1,2]], [[3, 4]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))')),
347347 (arrow_cast(make_array([[1,2]], [[4, 4]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1,2], [3, 4]), 'FixedSizeList(2, List(Int64))')),
348348 (arrow_cast(make_array([[1,2]], [[4, 4]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1,2,3], [1]), 'FixedSizeList(2, List(Int64))')),
349- (arrow_cast(make_array([[1], [2]], []), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([2], [3]), 'FixedSizeList(2, List(Int64))')),
350- (arrow_cast(make_array([[1], [2]], []), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))')),
349+ (arrow_cast(make_array([[1], [2]], [[] ]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([2], [3]), 'FixedSizeList(2, List(Int64))')),
350+ (arrow_cast(make_array([[1], [2]], [[] ]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))')),
351351 (arrow_cast(make_array([[1], [2]], [[2], [3]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))')),
352352 (arrow_cast(make_array([[1], [2]], [[2], [3]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))'))
353353;
@@ -2038,6 +2038,13 @@ NULL
20382038[, 51, 52, 54, 55, 56, 57, 58, 59, 60]
20392039[61, 62, 63, 64, 65, 66, 67, 68, 69, 70]
20402040
2041+ # test with empty array
2042+ query ?
2043+ select array_sort([]);
2044+ ----
2045+ []
2046+
2047+ # test with empty row, the row that does not match the condition has row count 0
20412048statement ok
20422049create table t1(a int, b int) as values (100, 1), (101, 2), (102, 3), (101, 2);
20432050
@@ -2083,10 +2090,10 @@ select
20832090
20842091query ????
20852092select
2086- array_append(arrow_cast(make_array(), 'LargeList(Null )'), 4),
2087- array_append(arrow_cast(make_array(), 'LargeList(Null )'), null),
2093+ array_append(arrow_cast(make_array(), 'LargeList(Int64 )'), 4),
2094+ array_append(arrow_cast(make_array(), 'LargeList(Int64 )'), null),
20882095 array_append(arrow_cast(make_array(1, null, 3), 'LargeList(Int64)'), 4),
2089- array_append(arrow_cast(make_array(null, null), 'LargeList(Null )'), 1)
2096+ array_append(arrow_cast(make_array(null, null), 'LargeList(Int64 )'), 1)
20902097;
20912098----
20922099[4] [] [1, , 3, 4] [, , 1]
@@ -2567,7 +2574,7 @@ query ????
25672574select
25682575 array_repeat(arrow_cast([1], 'LargeList(Int64)'), 5),
25692576 array_repeat(arrow_cast([1.1, 2.2, 3.3], 'LargeList(Float64)'), 3),
2570- array_repeat(arrow_cast([null, null], 'LargeList(Null )'), 3),
2577+ array_repeat(arrow_cast([null, null], 'LargeList(Int64 )'), 3),
25712578 array_repeat(arrow_cast([[1, 2], [3, 4]], 'LargeList(List(Int64))'), 2);
25722579----
25732580[[1], [1], [1], [1], [1]] [[1.1, 2.2, 3.3], [1.1, 2.2, 3.3], [1.1, 2.2, 3.3]] [[, ], [, ], [, ]] [[[1, 2], [3, 4]], [[1, 2], [3, 4]]]
@@ -2630,6 +2637,12 @@ drop table large_array_repeat_table;
26302637
26312638## array_concat (aliases: `array_cat`, `list_concat`, `list_cat`)
26322639
2640+ # test with empty array
2641+ query ?
2642+ select array_concat([]);
2643+ ----
2644+ []
2645+
26332646# array_concat error
26342647query error DataFusion error: Error during planning: The array_concat function can only accept list as the args\.
26352648select array_concat(1, 2);
@@ -2674,19 +2687,19 @@ select array_concat(make_array(), make_array(2, 3));
26742687query ?
26752688select array_concat(make_array(make_array(1, 2), make_array(3, 4)), make_array(make_array()));
26762689----
2677- [[1, 2], [3, 4]]
2690+ [[1, 2], [3, 4], [] ]
26782691
26792692# array_concat scalar function #8 (with empty arrays)
26802693query ?
26812694select array_concat(make_array(make_array(1, 2), make_array(3, 4)), make_array(make_array()), make_array(make_array(), make_array()), make_array(make_array(5, 6), make_array(7, 8)));
26822695----
2683- [[1, 2], [3, 4], [5, 6], [7, 8]]
2696+ [[1, 2], [3, 4], [], [], [], [ 5, 6], [7, 8]]
26842697
26852698# array_concat scalar function #9 (with empty arrays)
26862699query ?
26872700select array_concat(make_array(make_array()), make_array(make_array(1, 2), make_array(3, 4)));
26882701----
2689- [[1, 2], [3, 4]]
2702+ [[], [ 1, 2], [3, 4]]
26902703
26912704# array_cat scalar function #10 (function alias `array_concat`)
26922705query ??
@@ -3788,7 +3801,7 @@ select array_union([1,2,3], []);
37883801[1, 2, 3]
37893802
37903803query ?
3791- select array_union(arrow_cast([1,2,3], 'LargeList(Int64)'), arrow_cast([], 'LargeList(Null )'));
3804+ select array_union(arrow_cast([1,2,3], 'LargeList(Int64)'), arrow_cast([], 'LargeList(Int64 )'));
37923805----
37933806[1, 2, 3]
37943807
@@ -3836,7 +3849,7 @@ select array_union([], []);
38363849[]
38373850
38383851query ?
3839- select array_union(arrow_cast([], 'LargeList(Null )'), arrow_cast([], 'LargeList(Null )'));
3852+ select array_union(arrow_cast([], 'LargeList(Int64 )'), arrow_cast([], 'LargeList(Int64 )'));
38403853----
38413854[]
38423855
@@ -3847,7 +3860,7 @@ select array_union([[null]], []);
38473860[[]]
38483861
38493862query ?
3850- select array_union(arrow_cast([[null]], 'LargeList(List(Null ))'), arrow_cast([], 'LargeList(Null )'));
3863+ select array_union(arrow_cast([[null]], 'LargeList(List(Int64 ))'), arrow_cast([], 'LargeList(Int64 )'));
38513864----
38523865[[]]
38533866
@@ -3858,7 +3871,7 @@ select array_union([null], [null]);
38583871[]
38593872
38603873query ?
3861- select array_union(arrow_cast([[null]], 'LargeList(List(Null ))'), arrow_cast([[null]], 'LargeList(List(Null ))'));
3874+ select array_union(arrow_cast([[null]], 'LargeList(List(Int64 ))'), arrow_cast([[null]], 'LargeList(List(Int64 ))'));
38623875----
38633876[[]]
38643877
@@ -3869,7 +3882,7 @@ select array_union(null, []);
38693882[]
38703883
38713884query ?
3872- select array_union(null, arrow_cast([], 'LargeList(Null )'));
3885+ select array_union(null, arrow_cast([], 'LargeList(Int64 )'));
38733886----
38743887[]
38753888
@@ -4106,14 +4119,14 @@ select cardinality(make_array()), cardinality(make_array(make_array()))
41064119NULL 0
41074120
41084121query II
4109- select cardinality(arrow_cast(make_array(), 'LargeList(Null )')), cardinality(arrow_cast(make_array(make_array()), 'LargeList(List(Null ))'))
4122+ select cardinality(arrow_cast(make_array(), 'LargeList(Int64 )')), cardinality(arrow_cast(make_array(make_array()), 'LargeList(List(Int64 ))'))
41104123----
41114124NULL 0
41124125
41134126#TODO
41144127#https://github.com/apache/datafusion/issues/9158
41154128#query II
4116- #select cardinality(arrow_cast(make_array(), 'FixedSizeList(1, Null)')), cardinality(arrow_cast(make_array(make_array()), 'FixedSizeList(1, List(Null ))'))
4129+ #select cardinality(arrow_cast(make_array(), 'FixedSizeList(1, Null)')), cardinality(arrow_cast(make_array(make_array()), 'FixedSizeList(1, List(Int64 ))'))
41174130#----
41184131#NULL 0
41194132
@@ -4699,7 +4712,7 @@ select array_dims(make_array()), array_dims(make_array(make_array()))
46994712NULL [1, 0]
47004713
47014714query ??
4702- select array_dims(arrow_cast(make_array(), 'LargeList(Null )')), array_dims(arrow_cast(make_array(make_array()), 'LargeList(List(Null ))'))
4715+ select array_dims(arrow_cast(make_array(), 'LargeList(Int64 )')), array_dims(arrow_cast(make_array(make_array()), 'LargeList(List(Int64 ))'))
47034716----
47044717NULL [1, 0]
47054718
@@ -4861,7 +4874,7 @@ select array_ndims(make_array()), array_ndims(make_array(make_array()))
486148741 2
48624875
48634876query II
4864- select array_ndims(arrow_cast(make_array(), 'LargeList(Null )')), array_ndims(arrow_cast(make_array(make_array()), 'LargeList(List(Null ))'))
4877+ select array_ndims(arrow_cast(make_array(), 'LargeList(Int64 )')), array_ndims(arrow_cast(make_array(make_array()), 'LargeList(List(Int64 ))'))
48654878----
486648791 2
48674880
@@ -4882,7 +4895,7 @@ select list_ndims(make_array()), list_ndims(make_array(make_array()))
488248951 2
48834896
48844897query II
4885- select list_ndims(arrow_cast(make_array(), 'LargeList(Null )')), list_ndims(arrow_cast(make_array(make_array()), 'LargeList(List(Null ))'))
4898+ select list_ndims(arrow_cast(make_array(), 'LargeList(Int64 )')), list_ndims(arrow_cast(make_array(make_array()), 'LargeList(List(Int64 ))'))
48864899----
488749001 2
48884901
@@ -5500,7 +5513,7 @@ select array_intersect([], []);
55005513[]
55015514
55025515query ?
5503- select array_intersect(arrow_cast([], 'LargeList(Null )'), arrow_cast([], 'LargeList(Null )'));
5516+ select array_intersect(arrow_cast([], 'LargeList(Int64 )'), arrow_cast([], 'LargeList(Int64 )'));
55045517----
55055518[]
55065519
@@ -5530,7 +5543,17 @@ select array_intersect([], null);
55305543[]
55315544
55325545query ?
5533- select array_intersect(arrow_cast([], 'LargeList(Null)'), null);
5546+ select array_intersect([[1,2,3]], [[]]);
5547+ ----
5548+ []
5549+
5550+ query ?
5551+ select array_intersect([[null]], [[]]);
5552+ ----
5553+ []
5554+
5555+ query ?
5556+ select array_intersect(arrow_cast([], 'LargeList(Int64)'), null);
55345557----
55355558[]
55365559
@@ -5540,7 +5563,7 @@ select array_intersect(null, []);
55405563NULL
55415564
55425565query ?
5543- select array_intersect(null, arrow_cast([], 'LargeList(Null )'));
5566+ select array_intersect(null, arrow_cast([], 'LargeList(Int64 )'));
55445567----
55455568NULL
55465569
@@ -6196,7 +6219,7 @@ select empty(make_array());
61966219true
61976220
61986221query B
6199- select empty(arrow_cast(make_array(), 'LargeList(Null )'));
6222+ select empty(arrow_cast(make_array(), 'LargeList(Int64 )'));
62006223----
62016224true
62026225
@@ -6213,12 +6236,12 @@ select empty(make_array(NULL));
62136236false
62146237
62156238query B
6216- select empty(arrow_cast(make_array(NULL), 'LargeList(Null )'));
6239+ select empty(arrow_cast(make_array(NULL), 'LargeList(Int64 )'));
62176240----
62186241false
62196242
62206243query B
6221- select empty(arrow_cast(make_array(NULL), 'FixedSizeList(1, Null )'));
6244+ select empty(arrow_cast(make_array(NULL), 'FixedSizeList(1, Int64 )'));
62226245----
62236246false
62246247
@@ -6282,7 +6305,7 @@ select array_empty(make_array());
62826305true
62836306
62846307query B
6285- select array_empty(arrow_cast(make_array(), 'LargeList(Null )'));
6308+ select array_empty(arrow_cast(make_array(), 'LargeList(Int64 )'));
62866309----
62876310true
62886311
@@ -6293,7 +6316,7 @@ select array_empty(make_array(NULL));
62936316false
62946317
62956318query B
6296- select array_empty(arrow_cast(make_array(NULL), 'LargeList(Null )'));
6319+ select array_empty(arrow_cast(make_array(NULL), 'LargeList(Int64 )'));
62976320----
62986321false
62996322
@@ -6316,7 +6339,7 @@ select list_empty(make_array());
63166339true
63176340
63186341query B
6319- select list_empty(arrow_cast(make_array(), 'LargeList(Null )'));
6342+ select list_empty(arrow_cast(make_array(), 'LargeList(Int64 )'));
63206343----
63216344true
63226345
@@ -6327,7 +6350,7 @@ select list_empty(make_array(NULL));
63276350false
63286351
63296352query B
6330- select list_empty(arrow_cast(make_array(NULL), 'LargeList(Null )'));
6353+ select list_empty(arrow_cast(make_array(NULL), 'LargeList(Int64 )'));
63316354----
63326355false
63336356
0 commit comments