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
HIVE-25292 : to_unix_timestamp & unix_timestamp should support ENGLIS… #2433
Conversation
…H format by default
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@kgyrtkirk Could you please review this fix ? |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
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 could probably also consider also adding the US parsing instead of making it the default; what do you think?
so that it will work with the jvm's default locale and with US as well
My initial thoughts were the same as you, but in this way you need to create two DateTimeFormatters, and it seems that you can only use try{} catch{} to control the code logic (or is there a better way ?), which is not very elegant. Another reason is that I found in Apache Spark that spark to_unix_timestamp udf uses US Local to format the time by default. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
…H format by default
What changes were proposed in this pull request?
update to_unix_timestamp function, Now where the locale of the machine is not in English, the following sql can also return the result correctly:
Why are the changes needed?
English date is a more common usage, if there is no such patch, in the local non-English environment, the following usage, to_unix_timestamp function will return NULL
Does this PR introduce any user-facing change?
No
How was this patch tested?
To run hive in a non-English environment, the simpler way can use the jvm parameter
Then run the following sql statement to test, if the timestamp is returned, it is correct.