velvia commented on a change in pull request #8815:
URL: https://github.com/apache/arrow/pull/8815#discussion_r534374336



##########
File path: rust/datafusion/src/sql/planner.rs
##########
@@ -638,10 +638,13 @@ impl<'a, S: SchemaProvider> SqlToRel<'a, S> {
                 Ok(Expr::IsNotNull(Box::new(self.sql_to_rex(expr, schema)?)))
             }
 
-            SQLExpr::UnaryOp { ref op, ref expr } => match *op {
-                UnaryOperator::Not => {
+            SQLExpr::UnaryOp { ref op, ref expr } => match (op, expr) {
+                (UnaryOperator::Not, _) => {
                     Ok(Expr::Not(Box::new(self.sql_to_rex(expr, schema)?)))
-                }
+                },
+                (UnaryOperator::Minus, box SQLExpr::Value(Value::Number(n))) =>
+                    // Parse negative numbers properly
+                    Ok(lit(-n.parse::<f64>().unwrap())),

Review comment:
       Ok I'll parse both i64 and f64; however I can't recursively call 
`sql_to_rex` as I need to negate the number.




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