Skip to content

Commit 67b0f25

Browse files
authored
Fix Utf8View as Join Key (#13115)
1 parent feeb32a commit 67b0f25

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

datafusion/expr/src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ pub fn can_hash(data_type: &DataType) -> bool {
981981
},
982982
DataType::Utf8 => true,
983983
DataType::LargeUtf8 => true,
984+
DataType::Utf8View => true,
984985
DataType::Decimal128(_, _) => true,
985986
DataType::Date32 => true,
986987
DataType::Date64 => true,

datafusion/sqllogictest/test_files/joins.slt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,3 +4277,16 @@ physical_plan
42774277
02)--HashJoinExec: mode=CollectLeft, join_type=Full, on=[(c1@0, c1@0)], filter=c2@0 >= c2@1
42784278
03)----MemoryExec: partitions=1, partition_sizes=[1]
42794279
04)----MemoryExec: partitions=1, partition_sizes=[1]
4280+
4281+
# Test Utf8View as Join Key
4282+
# Issue: https://github.com/apache/datafusion/issues/12468
4283+
statement ok
4284+
CREATE TABLE table1(v1 STRING) AS VALUES ('foo'), (NULL);
4285+
4286+
statement ok
4287+
CREATE TABLE table1_stringview AS SELECT arrow_cast(v1, 'Utf8View') AS v1 FROM table1;
4288+
4289+
query T
4290+
select * from table1 as t1 natural join table1_stringview as t2;
4291+
----
4292+
foo

0 commit comments

Comments
 (0)