Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: case_when() TRUE should translate to ELSE #102

Closed
ghost opened this issue Jun 20, 2018 · 2 comments · Fixed by #142
Closed

feature request: case_when() TRUE should translate to ELSE #102

ghost opened this issue Jun 20, 2018 · 2 comments · Fixed by #142
Labels
bug an unexpected problem or unintended behavior func trans 🌍 Translation of individual functions to SQL wip work in progress

Comments

@ghost
Copy link

ghost commented Jun 20, 2018

@namarkus commented on Jun 20, 2018, 2:47 PM UTC:

sql translation of case_when() has no else clause

case_when works just fine with dataframes. Using it in a database environment, I'm missing the possibility of defining an else-clause:

translate_sql(case_when(
  height > 200 | mass > 200 ~ "large",
  species == "Droid"        ~ "robot",
  TRUE                      ~  "other"
))

translates to:
(...) WHEN (TRUE) THEN ('other') END
whereas it should translate to:
(...) ELSE ('other') END

This issue was moved by batpigandme from tidyverse/dplyr/issues/3688.

@cderv
Copy link
Contributor

cderv commented Jun 20, 2018

this is related to tidyverse/dplyr#3521 (not moved to dbplyr yet)
It is still WIP for an all-database solution.

@krlmlr
Copy link
Member

krlmlr commented Jun 25, 2018

Moved to #112 now.

@hadley hadley added bug an unexpected problem or unintended behavior wip work in progress func trans 🌍 Translation of individual functions to SQL labels Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior func trans 🌍 Translation of individual functions to SQL wip work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants