-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Make extract SQL expression timezone aware. #18615
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
base: main
Are you sure you want to change the base?
Conversation
|
@martin-g @Omega359 This PR is a direct port of #18417 which got really messy (my apologies 🥲) due to a whole lot of unwanted commits. Closed that so that we could have a clean PR. This contains the commit which addressed @martin-g thoughts for :
Improvements that could be made for future releases:
Lmk wdyt (my apologies again for the messy closure and reopening of a separate PR for this) |
| EXTRACT(DAY FROM TIMESTAMP '2023-10-30 18:20:59-07:00'), | ||
| EXTRACT(DAY FROM TIMESTAMP '2023-10-30 07:20:59+12:00'); | ||
| ---- | ||
| 2 31 29 |
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.
Please add tests for New Year Eve:
| 2 31 29 | |
| 2 31 29 | |
| query IIII | |
| SELECT EXTRACT(YEAR FROM TIMESTAMP '2023-12-31 18:20:59-08:45'), | |
| EXTRACT(MONTH FROM TIMESTAMP '2023-12-31 18:20:59-08:45'), | |
| EXTRACT(DAY FROM TIMESTAMP '2023-12-31 18:20:59-08:45'), | |
| EXTRACT(HOUR FROM TIMESTAMP '2023-12-31 18:20:59-08:45'), | |
| EXTRACT(HOUR FROM TIMESTAMP '2023-12-31 18:20:59-08:45'), | |
| EXTRACT(SECOND FROM TIMESTAMP '2023-12-31 18:20:59-08:45'); | |
| ---- | |
| 2024 01 01 03 05 59 | |
| query V | |
| SELECT EXTRACT(YEAR FROM TIMESTAMP '2024-01-01 03:05:59+08:45'), | |
| EXTRACT(MONTH FROM TIMESTAMP '2024-01-01 03:05:59+08:45'), | |
| EXTRACT(DAY FROM TIMESTAMP '2024-01-01 03:05:59+08:45'), | |
| EXTRACT(HOUR FROM TIMESTAMP '2024-01-01 03:05:59+08:45'), | |
| EXTRACT(HOUR FROM TIMESTAMP '2024-01-01 03:05:59+08:45'), | |
| EXTRACT(SECOND FROM TIMESTAMP '2024-01-01 03:05:59+08:45'); | |
| ---- | |
| 2023 12 31 18 20 59 |
I hope I got them right! :-)
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.
thanks for adding this scenario! I have committed with minor tweaks with the right test case format for slt : )
(the characters after 'query' tells us the type and rows returned)
Which issue does this PR close?
Closes #18228
What changes are included in this PR?
The PR supports the enabling of timezone as an execution config and also recognises proper and improper timezone offsets (HH:MM) with the timestamp.
Are these changes tested?
Yes (slt)
Are there any user-facing changes?
Yes, users will be able to query extract expression with the enablement of the timezone execution config.