mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-11 06:22:04 +00:00
Support IGNORE|RESPECT
NULLs clause in window functions (#998)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
8262abcd31
commit
b89edaa98b
14 changed files with 124 additions and 0 deletions
|
@ -785,6 +785,7 @@ impl<'a> Parser<'a> {
|
|||
Ok(Expr::Function(Function {
|
||||
name: ObjectName(vec![w.to_ident()]),
|
||||
args: vec![],
|
||||
null_treatment: None,
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
|
@ -987,6 +988,19 @@ impl<'a> Parser<'a> {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
let null_treatment = match self.parse_one_of_keywords(&[Keyword::RESPECT, Keyword::IGNORE])
|
||||
{
|
||||
Some(keyword) => {
|
||||
self.expect_keyword(Keyword::NULLS)?;
|
||||
|
||||
match keyword {
|
||||
Keyword::RESPECT => Some(NullTreatment::RespectNulls),
|
||||
Keyword::IGNORE => Some(NullTreatment::IgnoreNulls),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
let over = if self.parse_keyword(Keyword::OVER) {
|
||||
if self.consume_token(&Token::LParen) {
|
||||
let window_spec = self.parse_window_spec()?;
|
||||
|
@ -1000,6 +1014,7 @@ impl<'a> Parser<'a> {
|
|||
Ok(Expr::Function(Function {
|
||||
name,
|
||||
args,
|
||||
null_treatment,
|
||||
filter,
|
||||
over,
|
||||
distinct,
|
||||
|
@ -1018,6 +1033,7 @@ impl<'a> Parser<'a> {
|
|||
Ok(Expr::Function(Function {
|
||||
name,
|
||||
args,
|
||||
null_treatment: None,
|
||||
filter: None,
|
||||
over: None,
|
||||
distinct: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue