Skip to content

Commit

Permalink
address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Sep 24, 2019
1 parent 9ad3b7f commit af8d298
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions rust/datafusion/src/execution/physical_plan/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,30 @@ impl PhysicalExpr for BinaryExpr {
Operator::GtEq => comparison_op!(left, right, gt_eq),
Operator::Eq => comparison_op!(left, right, eq),
Operator::NotEq => comparison_op!(left, right, neq),
Operator::And => boolean_op!(left, right, and),
Operator::Or => boolean_op!(left, right, or),
Operator::And => {
if left.data_type() == &DataType::Boolean {
boolean_op!(left, right, and)
} else {
return Err(ExecutionError::General(format!(
"Cannot evaluate binary expression {:?} with types {:?} and {:?}",
self.op,
left.data_type(),
right.data_type()
)));
}
},
Operator::Or => {
if left.data_type() == &DataType::Boolean {
boolean_op!(left, right, or)
} else {
return Err(ExecutionError::General(format!(
"Cannot evaluate binary expression {:?} with types {:?} and {:?}",
self.op,
left.data_type(),
right.data_type()
)));
}
},
_ => Err(ExecutionError::General("Unsupported operator".to_string())),
}
}
Expand Down

0 comments on commit af8d298

Please sign in to comment.