You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/08/19 12:50:13 UTC

[GitHub] [arrow] alamb commented on a change in pull request #7998: ARROW-9788: [Rust] [DataFusion] Rename SelectionExec to FilterExec

alamb commented on a change in pull request #7998:
URL: https://github.com/apache/arrow/pull/7998#discussion_r473002717



##########
File path: rust/datafusion/src/execution/physical_plan/expressions.rs
##########
@@ -966,11 +966,32 @@ impl fmt::Display for BinaryExpr {
 
 impl PhysicalExpr for BinaryExpr {
     fn data_type(&self, input_schema: &Schema) -> Result<DataType> {
-        self.left.data_type(input_schema)
+        Ok(match self.op {
+            Operator::And
+            | Operator::Or
+            | Operator::Not
+            | Operator::NotLike
+            | Operator::Like
+            | Operator::Lt
+            | Operator::LtEq
+            | Operator::Eq
+            | Operator::NotEq
+            | Operator::Gt
+            | Operator::GtEq => DataType::Boolean,
+            Operator::Plus
+            | Operator::Minus
+            | Operator::Multiply
+            | Operator::Divide
+            | Operator::Modulus => {
+                // this assumes that the left and right expressions have already been co-coerced
+                // to the same type
+                self.left.data_type(input_schema)?

Review comment:
       it might be worth a ticket to track the work that `data_type for BinaryExpr is incorrect




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org