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


##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/DateTimeFormatPatternSpec.java:
##########
@@ -56,8 +59,8 @@ public DateTimeFormatPatternSpec(TimeFormat timeFormat) {
   public DateTimeFormatPatternSpec(TimeFormat timeFormat, @Nullable String 
sdfPatternWithTz) {
     _timeFormat = timeFormat;
     if (timeFormat == TimeFormat.SIMPLE_DATE_FORMAT) {
-      Preconditions.checkArgument(StringUtils.isNotEmpty(sdfPatternWithTz), 
"Must provide SIMPLE_DATE_FORMAT pattern");
-      Matcher m = SDF_PATTERN_WITH_TIMEZONE.matcher(sdfPatternWithTz);
+      Matcher m = sdfPatternWithTz != null ? 
SDF_PATTERN_WITH_TIMEZONE.matcher(sdfPatternWithTz)

Review Comment:
   We should skip the regex matching if it does not exist
   ```suggestion
         if (sdfPatternWithTz != null) {
           ...
         } else {
           _sdfPattern = null;
           _dateTimeZone = DEFAULT_DATE_TIME_ZONE;
         }
   ```



##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/DateTimeFormatPatternSpec.java:
##########
@@ -97,7 +106,14 @@ public DateTimeFormatPatternSpec(TimeFormat timeFormat, 
@Nullable String sdfPatt
         _dateTimeZone = DEFAULT_DATE_TIME_ZONE;
       }
       try {
-        _dateTimeFormatter = 
DateTimeFormat.forPattern(_sdfPattern).withZone(_dateTimeZone).withLocale(DEFAULT_LOCALE);
+        if (_sdfPattern == null) {
+          LOGGER.warn("SIMPLE_DATE_FORMAT pattern was found to be null. Using 
ISODateTimeFormat as default");

Review Comment:
   We shouldn't log warning here



##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/DateTimeFormatPatternSpec.java:
##########
@@ -71,7 +74,14 @@ public DateTimeFormatPatternSpec(TimeFormat timeFormat, 
@Nullable String sdfPatt
         _dateTimeZone = DEFAULT_DATE_TIME_ZONE;
       }
       try {
-        _dateTimeFormatter = 
DateTimeFormat.forPattern(_sdfPattern).withZone(_dateTimeZone).withLocale(DEFAULT_LOCALE);
+        if (_sdfPattern == null) {
+          LOGGER.warn("SIMPLE_DATE_FORMAT pattern was found to be null. Using 
ISODateTimeFormat as default");

Review Comment:
   We shouldn't log warning here



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to