seddonm1 commented on a change in pull request #8865:
URL: https://github.com/apache/arrow/pull/8865#discussion_r538071659



##########
File path: rust/datafusion/src/physical_plan/planner.rs
##########
@@ -535,6 +536,32 @@ impl DefaultPhysicalPlanner {
                     input_schema,
                 )
             }
+            Expr::Between {
+                expr,
+                negated,
+                low,
+                high,
+            } => {
+                let value_expr =
+                    self.create_physical_expr(expr, input_schema, ctx_state)?;
+                let low_expr = self.create_physical_expr(low, input_schema, 
ctx_state)?;
+                let high_expr =
+                    self.create_physical_expr(high, input_schema, ctx_state)?;
+
+                // rewrite the between into the two binary operators
+                let binary_expr = binary(
+                    binary(value_expr.clone(), Operator::GtEq, low_expr, 
input_schema)?,
+                    Operator::And,
+                    binary(value_expr.clone(), Operator::LtEq, high_expr, 
input_schema)?,
+                    input_schema,
+                );
+
+                if *negated {
+                    expressions::not(binary_expr?, input_schema)
+                } else {
+                    binary_expr
+                }
+            }

Review comment:
       @jorgecarleitao I have added a test in `tests/sql.rs`.




----------------------------------------------------------------
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:
[email protected]


Reply via email to