andygrove commented on a change in pull request #8815:
URL: https://github.com/apache/arrow/pull/8815#discussion_r533820801
##########
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:
`n` could be an i64 or f64. You could maybe recursively call sql_to_rex
to parse the `Value::Number` here.
----------------------------------------------------------------
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]