From 8bb70a2ee01dab5d0ea709a83f40880d6c5dd41f Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Mon, 10 Feb 2025 14:59:50 +0000 Subject: [PATCH] hack: don't coerce utf8 view inside dictionary --- datafusion/expr-common/src/type_coercion/binary.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/datafusion/expr-common/src/type_coercion/binary.rs b/datafusion/expr-common/src/type_coercion/binary.rs index 3be35490a4d0..4235524ed84a 100644 --- a/datafusion/expr-common/src/type_coercion/binary.rs +++ b/datafusion/expr-common/src/type_coercion/binary.rs @@ -146,7 +146,7 @@ impl<'a> BinaryTypeCoercer<'a> { } And | Or => if matches!((self.lhs, self.rhs), (Boolean | Null, Boolean | Null)) { // Logical binary boolean operators can only be evaluated for - // boolean or null arguments. + // boolean or null arguments. Ok(Signature::uniform(Boolean)) } else { plan_err!( @@ -502,6 +502,14 @@ pub fn type_union_resolution(data_types: &[DataType]) -> Option { } } + // HACK: DataType::Utf8View is not a meaningful dictionary value type, so + // just pull this out if we dict-encoded it + if let Some(DataType::Dictionary(_, value_type)) = &candidate_type { + if value_type.as_ref() == &DataType::Utf8View { + candidate_type = Some(DataType::Utf8View); + } + } + candidate_type }