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

add dplyr translation support for TIMESTAMP_TRUNC #536

Open
era127 opened this issue Jun 25, 2023 · 3 comments
Open

add dplyr translation support for TIMESTAMP_TRUNC #536

era127 opened this issue Jun 25, 2023 · 3 comments
Labels
dbplyr 🔧 feature a feature request or enhancement

Comments

@era127
Copy link

era127 commented Jun 25, 2023

The dplyr translation does not currently support the floor_date() function. Should it be mapped to the TIMESTAMP_TRUNC sql statement? The POSIXt objects are mapped to TIMESTAMP and not DATETIME so I think TIMESTAMP_TRUNC is best.

This is derived from dbplyr's translation for Postgres.

      floor_date = function(x, unit = "seconds") {
        unit <- arg_match(unit,
          c("second", "minute", "hour", "day", "week", "month", "quarter", "year")
        )
        sql_expr(TIMESTAMP_TRUNC(!!unit, !!x))
      },

I'm not sure how it would handle the translation of the timezone argument to TIMESTAMP_TRUNC because floor_date() does not support a timezone argument.

@hadley hadley added feature a feature request or enhancement dbplyr 🔧 labels Nov 2, 2023
@hadley
Copy link
Member

hadley commented Nov 2, 2023

Good idea!

@hadley
Copy link
Member

hadley commented Nov 7, 2023

@hadley
Copy link
Member

hadley commented Nov 15, 2023

Will wait on tidyverse/dbplyr#1357 and tackle a swathe of date functions all at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dbplyr 🔧 feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants