Jackie-Jiang commented on code in PR #11258:
URL: https://github.com/apache/pinot/pull/11258#discussion_r1330594640


##########
pinot-common/src/main/java/org/apache/pinot/common/function/DateTimePatternHandler.java:
##########
@@ -35,15 +35,23 @@ private DateTimePatternHandler() {
    */
   public static long parseDateTimeStringToEpochMillis(String dateTimeString, 
String pattern) {
     DateTimeFormatter dateTimeFormatter = getDateTimeFormatter(pattern);
-    return dateTimeFormatter.parseMillis(dateTimeString);
+    return parseMillis(dateTimeString, dateTimeFormatter);
   }
 
   /**
    * Converts the dateTimeString of passed pattern into a long of the millis 
since epoch
    */
   public static long parseDateTimeStringToEpochMillis(String dateTimeString, 
String pattern, String timezoneId) {
     DateTimeFormatter dateTimeFormatter = getDateTimeFormatter(pattern, 
timezoneId);
-    return dateTimeFormatter.parseMillis(dateTimeString);
+    return parseMillis(dateTimeString, dateTimeFormatter);
+  }
+
+  private static long parseMillis(String dateTimeString, DateTimeFormatter 
dateTimeFormatter) {
+    try {
+      return dateTimeFormatter.parseMillis(dateTimeString);
+    } catch (Exception e) {
+      return 0L;

Review Comment:
   I'd suggest doing it more explicitly by asking for an extra default value. 
This is similar to how we handle json path error



-- 
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: commits-unsubscr...@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to