mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 18:57:21 +00:00
Support bitwise and, or, xor (#181)
Operator precedence is coming from: https://cloud.google.com/bigquery/docs/reference/standard-sql/operators
This commit is contained in:
parent
00dc490f72
commit
b4699bd4a7
4 changed files with 66 additions and 5 deletions
|
@ -680,6 +680,27 @@ fn parse_string_agg() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_bitwise_ops() {
|
||||
let bitwise_ops = &[
|
||||
("^", BinaryOperator::BitwiseXor),
|
||||
("|", BinaryOperator::BitwiseOr),
|
||||
("&", BinaryOperator::BitwiseAnd),
|
||||
];
|
||||
|
||||
for (str_op, op) in bitwise_ops {
|
||||
let select = verified_only_select(&format!("SELECT a {} b", &str_op));
|
||||
assert_eq!(
|
||||
SelectItem::UnnamedExpr(Expr::BinaryOp {
|
||||
left: Box::new(Expr::Identifier(Ident::new("a"))),
|
||||
op: op.clone(),
|
||||
right: Box::new(Expr::Identifier(Ident::new("b"))),
|
||||
}),
|
||||
select.projection[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_between() {
|
||||
fn chk(negated: bool) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue