stym06 commented on code in PR #8779:
URL: https://github.com/apache/pinot/pull/8779#discussion_r884068776


##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/DateTimeFormatSpec.java:
##########
@@ -199,6 +270,26 @@ public static void validateFormat(String format) {
               "Incorrect format type: %s in format: %s. Must be of 
'[0-9]+:<TimeUnit>:SIMPLE_DATE_FORMAT:pattern'",
               formatTokens[FORMAT_TIMEFORMAT_POSITION], format);
     }
+    return formatTokens;
+  }
+
+  /**
+   * Validates the pipe format string in the dateTimeFieldSpec
+   */
+  public static String[] validatePipeFormat(String format) {
+    Preconditions.checkNotNull(format, "Format string in dateTimeFieldSpec 
must not be null");
+    String[] formatTokens = StringUtils.split(format, PIPE_SEPARATOR, 
MAX_FORMAT_TOKENS_PIPE);
+    Preconditions.checkState(formatTokens.length >= MIN_FORMAT_TOKENS_PIPE
+            && formatTokens.length <= MAX_FORMAT_TOKENS_PIPE,
+        "Incorrect format: %s. Must be of the format 
'EPOCH|<timeUnit>(|<size>)'"
+            + " or 'SDF|<timeFormat>(|<timezone>)' or 'TIMESTAMP'");
+    if (formatTokens.length == MAX_FORMAT_TOKENS_PIPE
+        && 
formatTokens[FORMAT_SIZE_POSITION].equals(TimeFormat.EPOCH.toString())) {

Review Comment:
   Added



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