mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-03 22:08:16 +00:00
feat: Support ANY/ALL operators (#477)
* feat: Support ANY/ALL operators * fix lint
This commit is contained in:
parent
e68bdae5f2
commit
8ef5fc8624
3 changed files with 56 additions and 5 deletions
|
@ -998,6 +998,32 @@ fn parse_bitwise_ops() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_binary_any() {
|
||||
let select = verified_only_select("SELECT a = ANY(b)");
|
||||
assert_eq!(
|
||||
SelectItem::UnnamedExpr(Expr::BinaryOp {
|
||||
left: Box::new(Expr::Identifier(Ident::new("a"))),
|
||||
op: BinaryOperator::Eq,
|
||||
right: Box::new(Expr::AnyOp(Box::new(Expr::Identifier(Ident::new("b"))))),
|
||||
}),
|
||||
select.projection[0]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_binary_all() {
|
||||
let select = verified_only_select("SELECT a = ALL(b)");
|
||||
assert_eq!(
|
||||
SelectItem::UnnamedExpr(Expr::BinaryOp {
|
||||
left: Box::new(Expr::Identifier(Ident::new("a"))),
|
||||
op: BinaryOperator::Eq,
|
||||
right: Box::new(Expr::AllOp(Box::new(Expr::Identifier(Ident::new("b"))))),
|
||||
}),
|
||||
select.projection[0]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_logical_xor() {
|
||||
let sql = "SELECT true XOR true, false XOR false, true XOR false, false XOR true";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue