Skip to content

Commit

Permalink
remove is_dictionary checks from binary_rule.rs that have been implem…
Browse files Browse the repository at this point in the history
…ented in arrow-rs already (#3552)
  • Loading branch information
kmitchener committed Sep 21, 2022
1 parent ff718d0 commit cec6395
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions datafusion/expr/src/binary_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn bitwise_coercion(left_type: &DataType, right_type: &DataType) -> Option<DataT
return None;
}

if left_type == right_type && !is_dictionary(left_type) {
if left_type == right_type {
return Some(left_type.clone());
}

Expand Down Expand Up @@ -570,10 +570,6 @@ fn temporal_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataTyp
}
}

pub(crate) fn is_dictionary(t: &DataType) -> bool {
matches!(t, DataType::Dictionary(_, _))
}

/// Coercion rule for numerical types: The type that both lhs and rhs
/// can be casted to for numerical calculation, while maintaining
/// maximum precision
Expand All @@ -585,9 +581,7 @@ fn numerical_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataTy
return None;
};

// can't compare dictionaries directly due to
// https://github.com/apache/arrow-rs/issues/1201
if lhs_type == rhs_type && !is_dictionary(lhs_type) {
if lhs_type == rhs_type {
// same type => all good
return Some(lhs_type.clone());
}
Expand All @@ -611,9 +605,7 @@ fn numerical_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataTy

/// coercion rules for equality operations. This is a superset of all numerical coercion rules.
fn eq_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<DataType> {
// can't compare dictionaries directly due to
// https://github.com/apache/arrow-rs/issues/1201
if lhs_type == rhs_type && !is_dictionary(lhs_type) {
if lhs_type == rhs_type {
// same type => equality is possible
return Some(lhs_type.clone());
}
Expand Down

0 comments on commit cec6395

Please sign in to comment.