diff --git a/NEWS.md b/NEWS.md index a3b4867da..7298c57ca 100644 --- a/NEWS.md +++ b/NEWS.md @@ -51,9 +51,12 @@ * Teradata: * `as.Date(x)` is now translate to `CAST(x AS DATE)` again unless `x` is a string (@mgirlich, #1285). + +* Snowflake: + * `na.rm = TRUE` is now respected in `pmin()` and `pmax()` instead (@fh-mthomson, #1329) * `remote_name()` now returns a string with the name of the table. To get the - qualified identifier use the newly added `remote_table()` (@mgirlich, #1280). + qualified identifier use the newly added `remote_table()` (@mgirlich, #1329). * Queries now qualify `*` with the table alias for better compatibility (@mgirlich, #1003). diff --git a/R/backend-snowflake.R b/R/backend-snowflake.R index 30f35eabb..543719318 100644 --- a/R/backend-snowflake.R +++ b/R/backend-snowflake.R @@ -192,15 +192,10 @@ sql_translation.Snowflake <- function(con) { ) sql_expr(DATE_TRUNC(!!unit, !!x)) }, - # LEAST / GREATEST on Snowflake will not respect na.rm = TRUE (similar ) + # LEAST / GREATEST on Snowflake will not respect na.rm = TRUE by default (similar to Oracle/Access) # https://docs.snowflake.com/en/sql-reference/functions/least # https://docs.snowflake.com/en/sql-reference/functions/greatest - # "If any of the argument values is NULL, the result is NULL." - # Source: https://stackoverflow.com/a/74529349/22193215 - # [move to PR context] References: - # * https://community.snowflake.com/s/question/0D50Z00009LHFw1SAH/greatest-and-null-values - # * https://stackoverflow.com/questions/74527418/how-to-use-greatest-in-snowflake-with-null-values?newreg=1d65af9409e5443b85843be173894863 - # * https://github.com/tidyverse/dbplyr/issues/118 + # Solution source: https://stackoverflow.com/a/74529349/22193215 pmin = function(..., na.rm = FALSE) { if (identical(na.rm, TRUE)) { dots <- snowflake_pmin_pmax_concat_dots(..., na.rm = na.rm, negate = TRUE)