Jackie-Jiang commented on a change in pull request #7804:
URL: https://github.com/apache/pinot/pull/7804#discussion_r766182227



##########
File path: 
pinot-spi/src/main/java/org/apache/pinot/spi/data/DateTimeFormatPatternSpec.java
##########
@@ -42,15 +43,21 @@
   private DateTimeZone _dateTimeZone = DEFAULT_DATETIMEZONE;
   private transient DateTimeFormatter _dateTimeFormatter;
 
+  public DateTimeFormatPatternSpec(String timeFormat) {
+    this(timeFormat, null);
+  }
+
   public DateTimeFormatPatternSpec(String timeFormat, String sdfPatternWithTz) 
{
     _timeFormat = DateTimeFieldSpec.TimeFormat.valueOf(timeFormat);
     if (_timeFormat.equals(DateTimeFieldSpec.TimeFormat.SIMPLE_DATE_FORMAT)) {
+      Preconditions.checkNotNull(sdfPatternWithTz);

Review comment:
       Put some exception message (e.g. `Must provide pattern for simple date 
format`)

##########
File path: 
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/SchemaUtils.java
##########
@@ -44,6 +47,13 @@
   private SchemaUtils() {
   }
 
+  // checker to ensure simple date format matches lexicographic ordering.
+  private static final Map<Character, Integer> DATETIME_PATTERN_ORDERING = new 
HashMap<>();
+  static {
+    DATETIME_PATTERN_ORDERING.putAll(ImmutableMap.of('y', 0, 'M', 1, 'd', 2));
+    DATETIME_PATTERN_ORDERING.putAll(ImmutableMap.of('H', 3, 'm', 4, 's', 5, 
'S', 6));

Review comment:
       (minor) Create an array to instantiate the map for readability
   ```suggestion
       char[] patternOrdering = new char[]{'y', 'M', 'd', 'H', 'm', 's', 'S'};
       for (int i = 0; i < patternOrdering.length; i++) {
         DATETIME_PATTERN_ORDERING.put(patternOrdering[i], i);
       }
   ```

##########
File path: 
pinot-spi/src/main/java/org/apache/pinot/spi/data/DateTimeFormatPatternSpec.java
##########
@@ -42,15 +43,21 @@
   private DateTimeZone _dateTimeZone = DEFAULT_DATETIMEZONE;
   private transient DateTimeFormatter _dateTimeFormatter;
 
+  public DateTimeFormatPatternSpec(String timeFormat) {
+    this(timeFormat, null);
+  }
+
   public DateTimeFormatPatternSpec(String timeFormat, String sdfPatternWithTz) 
{

Review comment:
       (minor) Annotate `sdfPatternWithTz` as Nullable




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