mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-16 04:54:59 +00:00
fix: unary negation operator with operators: Mul
, Div
and Mod
(#902)
This commit is contained in:
parent
f72b5a5d9b
commit
8877cbafa6
2 changed files with 25 additions and 6 deletions
|
@ -1074,7 +1074,7 @@ fn parse_compound_expr_2() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn parse_unary_math() {
|
||||
fn parse_unary_math_with_plus() {
|
||||
use self::Expr::*;
|
||||
let sql = "-a + -b";
|
||||
assert_eq!(
|
||||
|
@ -1093,6 +1093,26 @@ fn parse_unary_math() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_unary_math_with_multiply() {
|
||||
use self::Expr::*;
|
||||
let sql = "-a * -b";
|
||||
assert_eq!(
|
||||
BinaryOp {
|
||||
left: Box::new(UnaryOp {
|
||||
op: UnaryOperator::Minus,
|
||||
expr: Box::new(Identifier(Ident::new("a"))),
|
||||
}),
|
||||
op: BinaryOperator::Multiply,
|
||||
right: Box::new(UnaryOp {
|
||||
op: UnaryOperator::Minus,
|
||||
expr: Box::new(Identifier(Ident::new("b"))),
|
||||
}),
|
||||
},
|
||||
verified_expr(sql)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_is_null() {
|
||||
use self::Expr::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue