-
Notifications
You must be signed in to change notification settings - Fork 697
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
Feat(bigquery): transpile format_datetime, datetime_trunc to duckdb #3894
Feat(bigquery): transpile format_datetime, datetime_trunc to duckdb #3894
Conversation
Hi @skadel, thanks for the PR! Please run |
412a6d2
to
c6e9b08
Compare
c6e9b08
to
724e3fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good based on https://github.com/tobymao/sqlglot/pull/3894/files#r1712999820, but I may try a few cases myself in BQ to double check this later or tomorrow.
@skadel I tried a few examples and found at least one category that fails with the -- Works
SELECT FORMAT_DATETIME('%x', '2008-12-25 12:05:01') AS US_format
-- Doesn't work: Could not cast literal "2008-12-25 12:05:01" to type DATE at [1:26]
-- This is the query we get when we read/write with BQ using this PR
SELECT FORMAT_DATE('%x', '2008-12-25 12:05:01') AS US_format Let's not convert any of these two functions into the other one, these transformations are tricky to get right and I don't want to risk breaking users' queries with this. Perhaps you could leverage the fact that at parse time you produce |
724e3fa
to
b059b5a
Compare
You're right, i thought that TsOrDsToTimestamp cast it to timestamp so i tested SELECT FORMAT_DATE('%x', CAST('2008-12-25 12:05:01' AS DATETIME)). But you're right, it's better to keep the same function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution 🙌
No description provided.