Skip to content

Commit

Permalink
redo snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
fh-mthomson committed Jul 14, 2023
1 parent 41e70c7 commit 3ceadf4
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/testthat/_snaps/backend-snowflake.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
! `ignore.case = TRUE` isn't supported in Snowflake translation.
i It must be FALSE instead.

# pmin() and pmax() respect na.rm

Code
test_translate_sql(pmin(x, y, z, na.rm = TRUE))
Output
<SQL> COALESCE(IFF(COALESCE(IFF(`x` <= `y`, `x`, `y`), `x`, `y`) <= `z`, COALESCE(IFF(`x` <= `y`, `x`, `y`), `x`, `y`), `z`), COALESCE(IFF(`x` <= `y`, `x`, `y`), `x`, `y`), `z`)

---

Code
test_translate_sql(pmax(x, y, z, na.rm = TRUE))
Output
<SQL> COALESCE(IFF(COALESCE(IFF(`x` >= `y`, `x`, `y`), `x`, `y`) >= `z`, COALESCE(IFF(`x` >= `y`, `x`, `y`), `x`, `y`), `z`), COALESCE(IFF(`x` >= `y`, `x`, `y`), `x`, `y`), `z`)

# row_number() with and without group_by() and arrange(): unordered defaults to Ordering by NULL (per use_default_order_null)

Code
Expand All @@ -17,12 +31,7 @@
SELECT `df`.*, ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS `rown`
FROM `df`

# pmin() and pmax() respect na.rm

Code
test_translate_sql(pmin(x, y, z, na.rm = TRUE))
Output
<SQL> COALESCE(IFF(COALESCE(IFF(`x` <= `y`, `x`, `y`), `x`, `y`) <= `z`, COALESCE(IFF(`x` <= `y`, `x`, `y`), `x`, `y`), `z`), COALESCE(IFF(`x` <= `y`, `x`, `y`), `x`, `y`), `z`)
---

Code
mf %>% group_by(y) %>% mutate(rown = row_number())
Expand All @@ -33,10 +42,13 @@
ROW_NUMBER() OVER (PARTITION BY `y` ORDER BY (SELECT NULL)) AS `rown`
FROM `df`

---

Code
mf %>% arrange(y) %>% mutate(rown = row_number())
Output
<SQL>
SELECT `df`.*, ROW_NUMBER() OVER (ORDER BY `y`) AS `rown`
FROM `df`
ORDER BY `y`

0 comments on commit 3ceadf4

Please sign in to comment.