You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/02/03 18:27:55 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #8118: Infer SDF for Timestamp in dimension field spec

richardstartin commented on a change in pull request #8118:
URL: https://github.com/apache/pinot/pull/8118#discussion_r798853342



##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/utils/TimestampUtils.java
##########
@@ -60,8 +67,30 @@ public static long toMillisSinceEpoch(String timestampString) {
       try {
         return Long.parseLong(timestampString);
       } catch (Exception e1) {
-        throw new IllegalArgumentException(String.format("Invalid timestamp: '%s'", timestampString));
+        try {
+          return dateTimeToTimestamp(timestampString).getTime();
+        } catch (Exception e2) {
+          throw new IllegalArgumentException(String.format("Invalid timestamp: '%s'", timestampString));
+        }
+      }
+    }
+  }
+
+  /**
+   * Infers a date time format from a valid {@link Timestamp} string.
+   */
+  private static Timestamp dateTimeToTimestamp(String timestampString) {

Review comment:
       This will get called a lot on the critical path, so the point about `java.time` vs SDF is important.




-- 
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-unsubscribe@pinot.apache.org

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



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