Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/dialect/snowflake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ impl Dialect for SnowflakeDialect {
true
}

// Snowflake doesn't document this but `FIRST_VALUE(arg, { IGNORE | RESPECT } NULLS)`
// works (i.e. inside the argument list instead of after).
fn supports_window_function_null_treatment_arg(&self) -> bool {
true
}

/// See [doc](https://docs.snowflake.com/en/sql-reference/sql/set#syntax)
fn supports_parenthesized_set_variables(&self) -> bool {
true
Expand Down
9 changes: 9 additions & 0 deletions tests/sqlparser_snowflake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1576,3 +1576,12 @@ fn test_select_wildcard_with_ilike_replace() {
"sql parser error: Expected end of statement, found: EXCLUDE"
);
}

#[test]
fn first_value_ignore_nulls() {
snowflake().verified_only_select(concat!(
"SELECT FIRST_VALUE(column2 IGNORE NULLS) ",
"OVER (PARTITION BY column1 ORDER BY column2) ",
"FROM some_table"
));
}