From e27110fd11f6fb9a03e496b2f22e5a5adf883adb Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 19 Jan 2022 07:09:31 -0500 Subject: [PATCH] Comment rationale for not directly comparing Dictionary types --- datafusion/src/physical_plan/coercion_rule/binary_rule.rs | 4 ++++ datafusion/src/physical_plan/expressions/coercion.rs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/datafusion/src/physical_plan/coercion_rule/binary_rule.rs b/datafusion/src/physical_plan/coercion_rule/binary_rule.rs index 984d0d5a4bd6..e616afb11ab1 100644 --- a/datafusion/src/physical_plan/coercion_rule/binary_rule.rs +++ b/datafusion/src/physical_plan/coercion_rule/binary_rule.rs @@ -77,6 +77,8 @@ pub(crate) fn coerce_types( } fn comparison_eq_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option { + // can't compare dictionaries directly due to + // https://github.com/apache/arrow-rs/issues/1201 if lhs_type == rhs_type && !is_dictionary(lhs_type) { // same type => equality is possible return Some(lhs_type.clone()); @@ -90,6 +92,8 @@ fn comparison_order_coercion( lhs_type: &DataType, rhs_type: &DataType, ) -> Option { + // can't compare dictionaries directly due to + // https://github.com/apache/arrow-rs/issues/1201 if lhs_type == rhs_type && !is_dictionary(lhs_type) { // same type => all good return Some(lhs_type.clone()); diff --git a/datafusion/src/physical_plan/expressions/coercion.rs b/datafusion/src/physical_plan/expressions/coercion.rs index bcdfec0024db..7bfb567cbc7b 100644 --- a/datafusion/src/physical_plan/expressions/coercion.rs +++ b/datafusion/src/physical_plan/expressions/coercion.rs @@ -162,8 +162,10 @@ pub fn numerical_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option all good + // can't compare dictionaries directly due to + // https://github.com/apache/arrow-rs/issues/1201 if lhs_type == rhs_type && !is_dictionary(lhs_type) { + // same type => all good return Some(lhs_type.clone()); } @@ -186,6 +188,8 @@ pub fn numerical_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option Option { + // can't compare dictionaries directly due to + // https://github.com/apache/arrow-rs/issues/1201 if lhs_type == rhs_type && !is_dictionary(lhs_type) { // same type => equality is possible return Some(lhs_type.clone());