mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 03:07:20 +00:00
Support IN UNNEST(expression)
(#426)
* feat: support `IN UNNEST(expression)` * Add test for NOT IN UNNEST
This commit is contained in:
parent
2ebe18a94e
commit
0d1c5d1205
3 changed files with 50 additions and 0 deletions
|
@ -903,6 +903,27 @@ fn parse_in_subquery() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_in_unnest() {
|
||||
fn chk(negated: bool) {
|
||||
let sql = &format!(
|
||||
"SELECT * FROM customers WHERE segment {}IN UNNEST(expr)",
|
||||
if negated { "NOT " } else { "" }
|
||||
);
|
||||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
Expr::InUnnest {
|
||||
expr: Box::new(Expr::Identifier(Ident::new("segment"))),
|
||||
array_expr: Box::new(verified_expr("expr")),
|
||||
negated,
|
||||
},
|
||||
select.selection.unwrap()
|
||||
);
|
||||
}
|
||||
chk(false);
|
||||
chk(true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_string_agg() {
|
||||
let sql = "SELECT a || b";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue