Skip to content

Commit

Permalink
Add tests for concatenating differnet string types
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Jan 30, 2025
1 parent 07ee09a commit ecabac1
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions datafusion/sqllogictest/test_files/array.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ecabac1

Please sign in to comment.