izveigor commented on code in PR #6986:
URL: https://github.com/apache/arrow-datafusion/pull/6986#discussion_r1265156556


##########
datafusion/core/tests/sqllogictests/test_files/array.slt:
##########
@@ -554,28 +595,36 @@ select array_concat(column1, column2) from 
arrays_values_v2;
 [11, 12]
 NULL
 
-# TODO: Concat columns with different dimensions fails
-# array_concat column-wise #10 (1D + 2D)
-# query error DataFusion error: Arrow error: Invalid argument error: column 
types must match schema types, expected List\(Field \{ name: "item", data_type: 
Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: \{\} \}\) 
but found List\(Field \{ name: "item", data_type: List\(Field \{ name: "item", 
data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: 
\{\} \}\), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: \{\} 
\}\) at column index 0
-# select array_concat(make_array(column3), column4) from arrays_values_v2;
+# array_concat column-wise #9 (2D + 1D)
+query ?
+select array_concat(column4, make_array(column3)) from arrays_values_v2;
+----
+[[30, 40, 50], [12]]
+[[, , 60], [13]]
+[[70, , ], [14]]
+[[]]
+[[]]
+[[]]
+
+# array_concat column-wise #10 (3D + 2D + 1D)
+query ?
+select array_concat(column4, column1, column2) from nested_arrays;
+----
+[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[1, 2, 3], [2, 9, 1], [7, 
8, 9], [1, 2, 3], [1, 7, 4], [4, 5, 6]], [[7, 8, 9]]]
+[[[11, 12, 13], [14, 15, 16]], [[17, 18, 19], [20, 21, 22]], [[4, 5, 6], [10, 
11, 12], [4, 9, 8], [7, 8, 9], [10, 11, 12], [1, 8, 7]], [[10, 11, 12]]]
 
-# array_concat column-wise #11 (1D + Integers)

Review Comment:
   It seems like the regression, but PostgreSQL does not support concatenation 
between scalars (integers) and arrays.
   Should we keep this feature or is it better to follow the PostgreSQL 
standard? 🤔
   What do you think about it, @jayzhan211?



##########
datafusion/core/tests/sqllogictests/test_files/array.slt:
##########
@@ -554,28 +595,36 @@ select array_concat(column1, column2) from 
arrays_values_v2;
 [11, 12]
 NULL
 
-# TODO: Concat columns with different dimensions fails
-# array_concat column-wise #10 (1D + 2D)
-# query error DataFusion error: Arrow error: Invalid argument error: column 
types must match schema types, expected List\(Field \{ name: "item", data_type: 
Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: \{\} \}\) 
but found List\(Field \{ name: "item", data_type: List\(Field \{ name: "item", 
data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: 
\{\} \}\), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: \{\} 
\}\) at column index 0
-# select array_concat(make_array(column3), column4) from arrays_values_v2;
+# array_concat column-wise #9 (2D + 1D)
+query ?
+select array_concat(column4, make_array(column3)) from arrays_values_v2;
+----
+[[30, 40, 50], [12]]
+[[, , 60], [13]]
+[[70, , ], [14]]
+[[]]
+[[]]
+[[]]
+
+# array_concat column-wise #10 (3D + 2D + 1D)
+query ?
+select array_concat(column4, column1, column2) from nested_arrays;
+----
+[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[1, 2, 3], [2, 9, 1], [7, 
8, 9], [1, 2, 3], [1, 7, 4], [4, 5, 6]], [[7, 8, 9]]]
+[[[11, 12, 13], [14, 15, 16]], [[17, 18, 19], [20, 21, 22]], [[4, 5, 6], [10, 
11, 12], [4, 9, 8], [7, 8, 9], [10, 11, 12], [1, 8, 7]], [[10, 11, 12]]]
 
-# array_concat column-wise #11 (1D + Integers)

Review Comment:
   It seems like the regression, but PostgreSQL does not support concatenation 
between scalars (integers) and arrays.
   Should we keep this feature or is it better to follow the PostgreSQL 
standard? 🤔
   What do you think about it, @jayzhan211?



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