-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make from_unixtime aware of execution timezone #12892
Comments
UDF's currently do not have access to the DF context which would make implementing this using configuration a bit difficult. What could be easily supported is allowing an additional argument 'tz' which would be used to generate the timestamp in tz aware fashion. |
@Omega359 would that be desirable? I can start working on to overload |
Sounds good. I would like to still think about what it would take to get udf's access to the config though. |
This may now be feasible after |
Is your feature request related to a problem or challenge?
No response
Describe the solution you'd like
Applies an offset to the unixtime after the cast.
Describe alternatives you've considered
No response
Additional context
Datafusion's
from_unixtime
is not aware of timezone. The following code block demonstrates the interaction between me and datafusion-cli.Specifically, when converting a date to unixtime with the
to_unixtime
function, we can provide a timezone and the cast result could reveal the timezone. However, when converting the unixtime back to a date, Datafusion is not aware of timezone. Yes, the cast result is correct, but the timezone info is discarded and only a date with timezone UTC+0 is returned.I wonder if we can make the
from_unixtime
function aware of timezone. For example, by setting the execution timezone through thedatafusion.execution.time_zone
configuration, we can apply an offset to the cast result so the timezone info could be revealed.The text was updated successfully, but these errors were encountered: