Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add binary_view to string_view coercion #12643

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
Copy link
Contributor Author

@doupache doupache Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #12092
(LargeUtf8, BinaryView) => Some(Utf8View)

but i think we should coercion to LargeUtf8 ? , since LargeUtf8 it can be a huge string.
(LargeUtf8, BinaryView) => Some(LargeUtf8)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Arrow actually has the equivalent of LargeUtf8View but arrow-rs doesn't support it yet.

I think the mapping (LargeUtf8, BinaryView) => Some(LargeUtf8) makes sense to me for now

_ => 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;
Loading