You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/02/23 14:30:14 UTC

[GitHub] [hive] belugabehr commented on a change in pull request #2007: HIVE-24811: Extend Cached Dates to Other Areas

belugabehr commented on a change in pull request #2007:
URL: https://github.com/apache/hive/pull/2007#discussion_r581082406



##########
File path: common/src/java/org/apache/hadoop/hive/common/type/TimestampUtils.java
##########
@@ -176,7 +177,7 @@ public static Timestamp stringToTimestamp(String s) {
     // Handle simpler cases directly avoiding exceptions
     if (s.length() == DATE_LENGTH) {
       // Its a date!
-      return Timestamp.ofEpochMilli(Date.valueOf(s).toEpochMilli());
+      return Timestamp.ofEpochMilli(DateParser.parseDate(s).toEpochMilli());

Review comment:
       So, this one is a little weird.  Previously, `Date.valueOf` could potentially throw an `IllegalArgumentException` if the string was invalid, contrary to the comment:
   
   > Handle simpler cases directly avoiding exceptions
   
   Now, it could throw a NPE as DateParser returns `null` on invalid input.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org