tustvold commented on code in PR #2808:
URL: https://github.com/apache/arrow-datafusion/pull/2808#discussion_r908804986
##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -1009,11 +1009,28 @@ impl PhysicalExpr for BinaryExpr {
let left_data_type = left_value.data_type();
let right_data_type = right_value.data_type();
- if left_data_type != right_data_type {
- return Err(DataFusionError::Internal(format!(
- "Cannot evaluate binary expression {:?} with types {:?} and
{:?}",
- self.op, left_data_type, right_data_type
- )));
+ match (&left_value, &left_data_type, &right_value, &right_data_type) {
+ // Types are equal => valid
+ (_, l, _, r) if l == r => {}
+ // Allow comparing a dictionary value with its corresponding
scalar value
Review Comment:
This is actually necessary for correctness in addition to being beneficial
for performance, because ScalarValue does not have a way to encode a dictionary
data type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]