Skip to content

Commit

Permalink
add binary to string_view coercion (apache#12643)
Browse files Browse the repository at this point in the history
  • Loading branch information
doupache authored Sep 28, 2024
1 parent 792f07d commit c21d025
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datafusion/expr-common/src/type_coercion/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,12 +1052,16 @@ fn binary_to_string_coercion(
match (lhs_type, rhs_type) {
(Binary, Utf8) => Some(Utf8),
(Binary, LargeUtf8) => Some(LargeUtf8),
(BinaryView, Utf8) => Some(Utf8View),
(BinaryView, LargeUtf8) => Some(LargeUtf8),
(LargeBinary, Utf8) => Some(LargeUtf8),
(LargeBinary, LargeUtf8) => Some(LargeUtf8),
(Utf8, Binary) => Some(Utf8),
(Utf8, LargeBinary) => Some(LargeUtf8),
(Utf8, BinaryView) => Some(Utf8View),
(LargeUtf8, Binary) => Some(LargeUtf8),
(LargeUtf8, LargeBinary) => Some(LargeUtf8),
(LargeUtf8, BinaryView) => Some(LargeUtf8),
_ => None,
}
}
Expand Down
15 changes: 15 additions & 0 deletions datafusion/sqllogictest/test_files/binary_view.slt
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,18 @@ NULL R NULL NULL NULL NULL

statement ok
drop table test;

statement ok
create table bv as values
(
arrow_cast('one', 'BinaryView'),
arrow_cast('two', 'BinaryView')
);

query B
select column1 like 'o%' from bv;
----
true

statement ok
drop table bv;

0 comments on commit c21d025

Please sign in to comment.