Skip to content

Commit 5418446

Browse files
authored
Snowflake: support IGNORE/RESPECT NULLS inside function argument list (#1263)
1 parent 5ed13b5 commit 5418446

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/dialect/snowflake.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ impl Dialect for SnowflakeDialect {
7171
true
7272
}
7373

74+
// Snowflake doesn't document this but `FIRST_VALUE(arg, { IGNORE | RESPECT } NULLS)`
75+
// works (i.e. inside the argument list instead of after).
76+
fn supports_window_function_null_treatment_arg(&self) -> bool {
77+
true
78+
}
79+
7480
/// See [doc](https://docs.snowflake.com/en/sql-reference/sql/set#syntax)
7581
fn supports_parenthesized_set_variables(&self) -> bool {
7682
true

tests/sqlparser_snowflake.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,3 +1576,12 @@ fn test_select_wildcard_with_ilike_replace() {
15761576
"sql parser error: Expected end of statement, found: EXCLUDE"
15771577
);
15781578
}
1579+
1580+
#[test]
1581+
fn first_value_ignore_nulls() {
1582+
snowflake().verified_only_select(concat!(
1583+
"SELECT FIRST_VALUE(column2 IGNORE NULLS) ",
1584+
"OVER (PARTITION BY column1 ORDER BY column2) ",
1585+
"FROM some_table"
1586+
));
1587+
}

0 commit comments

Comments
 (0)