Skip to content

Commit b50887f

Browse files
committed
more tests
1 parent 610fdec commit b50887f

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

datafusion/expr/src/type_coercion/binary.rs

+1
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,7 @@ fn string_concat_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<Da
892892
use arrow::datatypes::DataType::*;
893893
match (lhs_type, rhs_type) {
894894
// If Utf8View is in any side, we coerce to Utf8.
895+
// Ref: https://github.com/apache/datafusion/pull/11796
895896
(Utf8View, Utf8View | Utf8 | LargeUtf8) | (Utf8 | LargeUtf8, Utf8View) => {
896897
Some(Utf8)
897898
}

datafusion/sqllogictest/test_files/string_view.slt

+48-4
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,54 @@ statement ok
381381
drop table dates;
382382

383383
statement ok
384-
create table temp as values ('value1', arrow_cast('one', 'Utf8View')), ('value1', arrow_cast('two', 'Utf8View'));
384+
create table temp as values
385+
('value1', arrow_cast('rust', 'Utf8View'), arrow_cast('fast', 'Utf8View')),
386+
('value2', arrow_cast('datafusion', 'Utf8View'), arrow_cast('cool', 'Utf8View'));
385387

386388
query T
387-
select column2||'ff' from temp;
389+
select column2||' is fast' from temp;
388390
----
389-
oneff
390-
twoff
391+
rust is fast
392+
datafusion is fast
393+
394+
395+
query T
396+
select column2 || ' is ' || column3 from temp;
397+
----
398+
rust is fast
399+
datafusion is cool
400+
401+
query TT
402+
explain select column2 || 'is' || column3 from temp;
403+
----
404+
logical_plan
405+
01)Projection: CAST(temp.column2 AS Utf8) || Utf8("is") || CAST(temp.column3 AS Utf8)
406+
02)--TableScan: temp projection=[column2, column3]
407+
408+
409+
query TT
410+
explain select column2||' is fast' from temp;
411+
----
412+
logical_plan
413+
01)Projection: CAST(temp.column2 AS Utf8) || Utf8(" is fast")
414+
02)--TableScan: temp projection=[column2]
415+
416+
417+
query T
418+
select column2||column3 from temp;
419+
----
420+
rustfast
421+
datafusioncool
422+
423+
query TT
424+
explain select column2||column3 from temp;
425+
----
426+
logical_plan
427+
01)Projection: CAST(temp.column2 AS Utf8) || CAST(temp.column3 AS Utf8)
428+
02)--TableScan: temp projection=[column2, column3]
429+
430+
query T
431+
select column2|| ' ' ||column3 from temp;
432+
----
433+
rust fast
434+
datafusion cool

0 commit comments

Comments
 (0)