TuroczyX commented on code in PR #4170:
URL: https://github.com/apache/hive/pull/4170#discussion_r1168500611
##########
common/src/java/org/apache/hive/common/util/TimestampParser.java:
##########
@@ -199,6 +205,19 @@ public Timestamp parseTimestamp(final String text) {
}
+ public TimestampTZ parseTimestamp(String text, ZoneId defaultTimeZone) {
+ Objects.requireNonNull(text);
+ for (DateTimeFormatter f : dtFormatters) {
+ try {
+ return TimestampTZUtil.parse(text, defaultTimeZone, f);
+ } catch (DateTimeException e) {
Review Comment:
Also, from pattern perspective a TryParse would be more elegant in this
case. Of course it is just preferences, but I like this pattern. Way more
descriptive from code reading perspective.
https://learn.microsoft.com/en-us/dotnet/api/system.int32.tryparse?view=net-8.0#system-int32-tryparse(system-string-system-int32@)
I know ref and out keyword are not exists in Java but with return type it is
possible to handle. (Just FYI, no need to change)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]