mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 05:30:19 +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
|
@ -1143,6 +1143,18 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// Parses the parens following the `[ NOT ] IN` operator
|
||||
pub fn parse_in(&mut self, expr: Expr, negated: bool) -> Result<Expr, ParserError> {
|
||||
// BigQuery allows `IN UNNEST(array_expression)`
|
||||
// https://cloud.google.com/bigquery/docs/reference/standard-sql/operators#in_operators
|
||||
if self.parse_keyword(Keyword::UNNEST) {
|
||||
self.expect_token(&Token::LParen)?;
|
||||
let array_expr = self.parse_expr()?;
|
||||
self.expect_token(&Token::RParen)?;
|
||||
return Ok(Expr::InUnnest {
|
||||
expr: Box::new(expr),
|
||||
array_expr: Box::new(array_expr),
|
||||
negated,
|
||||
});
|
||||
}
|
||||
self.expect_token(&Token::LParen)?;
|
||||
let in_op = if self.parse_keyword(Keyword::SELECT) || self.parse_keyword(Keyword::WITH) {
|
||||
self.prev_token();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue