-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Feat: Make current_date aware of execution timezone. #18034
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
Conversation
); | ||
|
||
// Get timezone from config and convert to local time | ||
let days = if let Some(config) = info.execution_props().config_options() { |
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.
I think we can rewrite this into something more idiomatic
let days = info
.execution_props()
.config_options()
.and_then(|config| config.execution.time_zone.parse::<Tz>().ok())
.map_or_else(
|| datetime_to_days(&now_ts),
|tz| {
let local_now = tz.from_utc_datetime(&now_ts.naive_utc());
datetime_to_days(&local_now)
},
);
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 @codetyri0n it looks good to me
|
||
#Test 4: Verify current_date matches cast(now() as date) in the same timezone | ||
query B | ||
SELECT current_date() = cast(now() as date); |
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.
For some reason, this test appears to be failing on main:
Which issue does this PR close?
Rationale for this change
What changes are included in this PR?
Are these changes tested?