This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new ce3e3874ec feat: coerce from fixed size binary to binary view (#16110)
ce3e3874ec is described below
commit ce3e3874ec74742d26361625e226a47f69f8f549
Author: Chen Chongchen <[email protected]>
AuthorDate: Wed May 21 23:40:18 2025 +0800
feat: coerce from fixed size binary to binary view (#16110)
---
datafusion/expr-common/src/type_coercion/binary.rs | 3 +++
datafusion/sqllogictest/test_files/binary.slt | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/datafusion/expr-common/src/type_coercion/binary.rs
b/datafusion/expr-common/src/type_coercion/binary.rs
index 9ab83dd0bf..d0fcda9733 100644
--- a/datafusion/expr-common/src/type_coercion/binary.rs
+++ b/datafusion/expr-common/src/type_coercion/binary.rs
@@ -1303,6 +1303,9 @@ fn binary_coercion(lhs_type: &DataType, rhs_type:
&DataType) -> Option<DataType>
// Cast FixedSizeBinary to Binary
(FixedSizeBinary(_), Binary) | (Binary, FixedSizeBinary(_)) =>
Some(Binary),
+ (FixedSizeBinary(_), BinaryView) | (BinaryView, FixedSizeBinary(_)) =>
{
+ Some(BinaryView)
+ }
_ => None,
}
diff --git a/datafusion/sqllogictest/test_files/binary.slt
b/datafusion/sqllogictest/test_files/binary.slt
index 5ac13779ac..1077c32e46 100644
--- a/datafusion/sqllogictest/test_files/binary.slt
+++ b/datafusion/sqllogictest/test_files/binary.slt
@@ -165,6 +165,15 @@ NULL NULL
ff0102 false
000102 true
+query ?B
+SELECT arrow_cast(column1, 'FixedSizeBinary(3)'), arrow_cast(column1,
'FixedSizeBinary(3)') = arrow_cast(arrow_cast(X'000102', 'FixedSizeBinary(3)'),
'BinaryView') FROM t;
+----
+000102 true
+003102 false
+NULL NULL
+ff0102 false
+000102 true
+
# Plan should not have a cast of the column (should have casted the literal
# to FixedSizeBinary as that is much faster)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]