@@ -346,8 +346,8 @@ AS VALUES
346
346
(arrow_cast(make_array([[1,2]], [[3, 4]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))')),
347
347
(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))')),
348
348
(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))')),
351
351
(arrow_cast(make_array([[1], [2]], [[2], [3]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))')),
352
352
(arrow_cast(make_array([[1], [2]], [[2], [3]]), 'FixedSizeList(2, List(List(Int64)))'), arrow_cast(make_array([1], [2]), 'FixedSizeList(2, List(Int64))'))
353
353
;
@@ -2038,6 +2038,13 @@ NULL
2038
2038
[, 51, 52, 54, 55, 56, 57, 58, 59, 60]
2039
2039
[61, 62, 63, 64, 65, 66, 67, 68, 69, 70]
2040
2040
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
2041
2048
statement ok
2042
2049
create table t1(a int, b int) as values (100, 1), (101, 2), (102, 3), (101, 2);
2043
2050
@@ -2083,10 +2090,10 @@ select
2083
2090
2084
2091
query ????
2085
2092
select
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),
2088
2095
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)
2090
2097
;
2091
2098
----
2092
2099
[4] [] [1, , 3, 4] [, , 1]
@@ -2567,7 +2574,7 @@ query ????
2567
2574
select
2568
2575
array_repeat(arrow_cast([1], 'LargeList(Int64)'), 5),
2569
2576
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),
2571
2578
array_repeat(arrow_cast([[1, 2], [3, 4]], 'LargeList(List(Int64))'), 2);
2572
2579
----
2573
2580
[[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;
2630
2637
2631
2638
## array_concat (aliases: `array_cat`, `list_concat`, `list_cat`)
2632
2639
2640
+ # test with empty array
2641
+ query ?
2642
+ select array_concat([]);
2643
+ ----
2644
+ []
2645
+
2633
2646
# array_concat error
2634
2647
query error DataFusion error: Error during planning: The array_concat function can only accept list as the args\.
2635
2648
select array_concat(1, 2);
@@ -2674,19 +2687,19 @@ select array_concat(make_array(), make_array(2, 3));
2674
2687
query ?
2675
2688
select array_concat(make_array(make_array(1, 2), make_array(3, 4)), make_array(make_array()));
2676
2689
----
2677
- [[1, 2], [3, 4]]
2690
+ [[1, 2], [3, 4], [] ]
2678
2691
2679
2692
# array_concat scalar function #8 (with empty arrays)
2680
2693
query ?
2681
2694
select 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)));
2682
2695
----
2683
- [[1, 2], [3, 4], [5, 6], [7, 8]]
2696
+ [[1, 2], [3, 4], [], [], [], [ 5, 6], [7, 8]]
2684
2697
2685
2698
# array_concat scalar function #9 (with empty arrays)
2686
2699
query ?
2687
2700
select array_concat(make_array(make_array()), make_array(make_array(1, 2), make_array(3, 4)));
2688
2701
----
2689
- [[1, 2], [3, 4]]
2702
+ [[], [ 1, 2], [3, 4]]
2690
2703
2691
2704
# array_cat scalar function #10 (function alias `array_concat`)
2692
2705
query ??
@@ -3788,7 +3801,7 @@ select array_union([1,2,3], []);
3788
3801
[1, 2, 3]
3789
3802
3790
3803
query ?
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 )'));
3792
3805
----
3793
3806
[1, 2, 3]
3794
3807
@@ -3836,7 +3849,7 @@ select array_union([], []);
3836
3849
[]
3837
3850
3838
3851
query ?
3839
- select array_union(arrow_cast([], 'LargeList(Null )'), arrow_cast([], 'LargeList(Null )'));
3852
+ select array_union(arrow_cast([], 'LargeList(Int64 )'), arrow_cast([], 'LargeList(Int64 )'));
3840
3853
----
3841
3854
[]
3842
3855
@@ -3847,7 +3860,7 @@ select array_union([[null]], []);
3847
3860
[[]]
3848
3861
3849
3862
query ?
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 )'));
3851
3864
----
3852
3865
[[]]
3853
3866
@@ -3858,7 +3871,7 @@ select array_union([null], [null]);
3858
3871
[]
3859
3872
3860
3873
query ?
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 ))'));
3862
3875
----
3863
3876
[[]]
3864
3877
@@ -3869,7 +3882,7 @@ select array_union(null, []);
3869
3882
[]
3870
3883
3871
3884
query ?
3872
- select array_union(null, arrow_cast([], 'LargeList(Null )'));
3885
+ select array_union(null, arrow_cast([], 'LargeList(Int64 )'));
3873
3886
----
3874
3887
[]
3875
3888
@@ -4106,14 +4119,14 @@ select cardinality(make_array()), cardinality(make_array(make_array()))
4106
4119
NULL 0
4107
4120
4108
4121
query 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 ))'))
4110
4123
----
4111
4124
NULL 0
4112
4125
4113
4126
#TODO
4114
4127
#https://github.com/apache/datafusion/issues/9158
4115
4128
#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 ))'))
4117
4130
#----
4118
4131
#NULL 0
4119
4132
@@ -4699,7 +4712,7 @@ select array_dims(make_array()), array_dims(make_array(make_array()))
4699
4712
NULL [1, 0]
4700
4713
4701
4714
query ??
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 ))'))
4703
4716
----
4704
4717
NULL [1, 0]
4705
4718
@@ -4861,7 +4874,7 @@ select array_ndims(make_array()), array_ndims(make_array(make_array()))
4861
4874
1 2
4862
4875
4863
4876
query 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 ))'))
4865
4878
----
4866
4879
1 2
4867
4880
@@ -4882,7 +4895,7 @@ select list_ndims(make_array()), list_ndims(make_array(make_array()))
4882
4895
1 2
4883
4896
4884
4897
query 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 ))'))
4886
4899
----
4887
4900
1 2
4888
4901
@@ -5500,7 +5513,7 @@ select array_intersect([], []);
5500
5513
[]
5501
5514
5502
5515
query ?
5503
- select array_intersect(arrow_cast([], 'LargeList(Null )'), arrow_cast([], 'LargeList(Null )'));
5516
+ select array_intersect(arrow_cast([], 'LargeList(Int64 )'), arrow_cast([], 'LargeList(Int64 )'));
5504
5517
----
5505
5518
[]
5506
5519
@@ -5530,7 +5543,17 @@ select array_intersect([], null);
5530
5543
[]
5531
5544
5532
5545
query ?
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);
5534
5557
----
5535
5558
[]
5536
5559
@@ -5540,7 +5563,7 @@ select array_intersect(null, []);
5540
5563
NULL
5541
5564
5542
5565
query ?
5543
- select array_intersect(null, arrow_cast([], 'LargeList(Null )'));
5566
+ select array_intersect(null, arrow_cast([], 'LargeList(Int64 )'));
5544
5567
----
5545
5568
NULL
5546
5569
@@ -6196,7 +6219,7 @@ select empty(make_array());
6196
6219
true
6197
6220
6198
6221
query B
6199
- select empty(arrow_cast(make_array(), 'LargeList(Null )'));
6222
+ select empty(arrow_cast(make_array(), 'LargeList(Int64 )'));
6200
6223
----
6201
6224
true
6202
6225
@@ -6213,12 +6236,12 @@ select empty(make_array(NULL));
6213
6236
false
6214
6237
6215
6238
query B
6216
- select empty(arrow_cast(make_array(NULL), 'LargeList(Null )'));
6239
+ select empty(arrow_cast(make_array(NULL), 'LargeList(Int64 )'));
6217
6240
----
6218
6241
false
6219
6242
6220
6243
query B
6221
- select empty(arrow_cast(make_array(NULL), 'FixedSizeList(1, Null )'));
6244
+ select empty(arrow_cast(make_array(NULL), 'FixedSizeList(1, Int64 )'));
6222
6245
----
6223
6246
false
6224
6247
@@ -6282,7 +6305,7 @@ select array_empty(make_array());
6282
6305
true
6283
6306
6284
6307
query B
6285
- select array_empty(arrow_cast(make_array(), 'LargeList(Null )'));
6308
+ select array_empty(arrow_cast(make_array(), 'LargeList(Int64 )'));
6286
6309
----
6287
6310
true
6288
6311
@@ -6293,7 +6316,7 @@ select array_empty(make_array(NULL));
6293
6316
false
6294
6317
6295
6318
query B
6296
- select array_empty(arrow_cast(make_array(NULL), 'LargeList(Null )'));
6319
+ select array_empty(arrow_cast(make_array(NULL), 'LargeList(Int64 )'));
6297
6320
----
6298
6321
false
6299
6322
@@ -6316,7 +6339,7 @@ select list_empty(make_array());
6316
6339
true
6317
6340
6318
6341
query B
6319
- select list_empty(arrow_cast(make_array(), 'LargeList(Null )'));
6342
+ select list_empty(arrow_cast(make_array(), 'LargeList(Int64 )'));
6320
6343
----
6321
6344
true
6322
6345
@@ -6327,7 +6350,7 @@ select list_empty(make_array(NULL));
6327
6350
false
6328
6351
6329
6352
query B
6330
- select list_empty(arrow_cast(make_array(NULL), 'LargeList(Null )'));
6353
+ select list_empty(arrow_cast(make_array(NULL), 'LargeList(Int64 )'));
6331
6354
----
6332
6355
false
6333
6356
0 commit comments