Skip to content

Apache DataFusion SQL Query Engine

fix: `List` of `FixedSizeList` coercion issue in SQL (#14468)

Li-Lun Lin22a206125984
diff --git a/datafusion/functions-nested/src/make_array.rs b/datafusion/functions-nested/src/make_array.rs
index 0283cdd402..cd07d364e4 100644
--- a/datafusion/functions-nested/src/make_array.rs
+++ b/datafusion/functions-nested/src/make_array.rs
@@ -136,10 +136,7 @@ impl ScalarUDFImpl for MakeArray {
}
if let Some(new_type) = type_union_resolution(arg_types) {
- // TODO: Move FixedSizeList to List in type_union_resolution
- if let DataType::FixedSizeList(field, _) = new_type {
- Ok(vec![List(field); arg_types.len()])
- } else if new_type.is_null() {
+ if new_type.is_null() {
Ok(vec![DataType::Int64; arg_types.len()])
} else {
Ok(vec![new_type; arg_types.len()])
diff --git a/datafusion/sqllogictest/test_files/array.slt b/datafusion/sqllogictest/test_files/array.slt
index ff701b5540..79a2808750 100644
--- a/datafusion/sqllogictest/test_files/array.slt
+++ b/datafusion/sqllogictest/test_files/array.slt
@@ -6862,9 +6862,8 @@ select make_array(f0) from fixed_size_list_array
query T
select arrow_typeof(make_array(f0)) from fixed_size_list_array
----
-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: {} })
-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: {} })
-
+List(Field { name: "item", data_type: FixedSizeList(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, 2), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })
+List(Field { name: "item", data_type: FixedSizeList(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, 2), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })
query ?
select array_concat(column1, [7]) from arrays_values_v2;