From ecabac18c0b1d5f6b4983906c718bee8c8244ff2 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Thu, 30 Jan 2025 15:56:10 -0500 Subject: [PATCH] Add tests for concatenating differnet string types --- datafusion/sqllogictest/test_files/array.slt | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/datafusion/sqllogictest/test_files/array.slt b/datafusion/sqllogictest/test_files/array.slt index 46dbb4816694..398012f8e3df 100644 --- a/datafusion/sqllogictest/test_files/array.slt +++ b/datafusion/sqllogictest/test_files/array.slt @@ -2848,6 +2848,47 @@ select array_concat([]); ---- [] +# Concatenating strings arrays +query ? +select array_concat( + ['1', '2'], + ['3'] +); +---- +[1, 2, 3] + +# Concatenating string arrays +query ? +select array_concat( + [arrow_cast('1', 'LargeUtf8'), arrow_cast('2', 'LargeUtf8')], + [arrow_cast('3', 'LargeUtf8')] +); +---- +[1, 2, 3] + +# Concatenating stringview +query ? +select array_concat( + [arrow_cast('1', 'Utf8View'), arrow_cast('2', 'Utf8View')], + [arrow_cast('3', 'Utf8View')] +); +---- +[1, 2, 3] + +# Concatenating Mixed types (doesn't work) +query error DataFusion error: Arrow error: Invalid argument error: It is not possible to concatenate arrays of different data types\. +select array_concat( + [arrow_cast('1', 'Utf8'), arrow_cast('2', 'Utf8')], + [arrow_cast('3', 'LargeUtf8')] +); + +# Concatenating Mixed types (doesn't work) +query error DataFusion error: Execution error: There is no wider type that can represent both Utf8 and Utf8View\. +select array_concat( + [arrow_cast('1', 'Utf8'), arrow_cast('2', 'Utf8')], + [arrow_cast('3', 'Utf8View')] +); + # array_concat error query error DataFusion error: Error during planning: The array_concat function can only accept list as the args\. select array_concat(1, 2);