You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when experimenting with the new case_match, I noticed that I need to pass the criteria on the LHS as a vector, otherwise faulty SQL is generated (since those expressions are not enclosed in single quotation marks in this case). See the following reprex.
Is this intentional, or a bug?
library(dplyr, warn.conflicts=FALSE)
library(dbplyr, warn.conflicts=FALSE)
table<- tbl_lazy(tibble(col1= c(1, 2), col2= c(1, 2)), dbplyr::simulate_hana())
table %>%
mutate(
test=
case_match(
col1,
"pos_1"~1L, # does not work"pos_2"~2L, # does not work
c("pos_3") ~3L, # does work
c("pos_4") ~4L# does work
)
)
#> <SQL>#> SELECT#> *,#> CASE#> WHEN (`col1` IN (pos_1)) THEN 1#> WHEN (`col1` IN (pos_2)) THEN 2#> WHEN (`col1` IN ('pos_3')) THEN 3#> WHEN (`col1` IN ('pos_4')) THEN 4#> END AS `test`#> FROM `df`
Good morning,
when experimenting with the new
case_match
, I noticed that I need to pass the criteria on the LHS as a vector, otherwise faulty SQL is generated (since those expressions are not enclosed in single quotation marks in this case). See the following reprex.Is this intentional, or a bug?
Created on 2023-02-09 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: