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/06/23 23:29:51 UTC

[GitHub] [pinot] xiangfu0 commented on a diff in pull request #8960: Refector DateTime field specs to reduce overhead

xiangfu0 commented on code in PR #8960:
URL: https://github.com/apache/pinot/pull/8960#discussion_r905583504


##########
pinot-plugins/pinot-batch-ingestion/v0_deprecated/pinot-hadoop/src/main/java/org/apache/pinot/hadoop/job/mappers/SegmentPreprocessingMapper.java:
##########
@@ -68,15 +68,36 @@ public void setup(final Context context) {
       String timeColumnValue = _jobConf.get(InternalConfigConstants.TIME_COLUMN_VALUE);
       String pushFrequency = _jobConf.get(InternalConfigConstants.SEGMENT_PUSH_FREQUENCY);
 
-      String timeType = _jobConf.get(InternalConfigConstants.SEGMENT_TIME_TYPE);
-      String timeFormat = _jobConf.get(InternalConfigConstants.SEGMENT_TIME_FORMAT);
+      String timeFormatStr = _jobConf.get(InternalConfigConstants.SEGMENT_TIME_FORMAT);
+      DateTimeFieldSpec.TimeFormat timeFormat;
+      try {
+        timeFormat = DateTimeFieldSpec.TimeFormat.valueOf(timeFormatStr);
+      } catch (Exception e) {
+        throw new IllegalArgumentException("Invalid time format: " + timeFormatStr);
+      }
       DateTimeFormatSpec dateTimeFormatSpec;
-      if (timeFormat.equals(DateTimeFieldSpec.TimeFormat.EPOCH.toString()) || timeFormat.equals(
-          DateTimeFieldSpec.TimeFormat.TIMESTAMP.toString())) {
-        dateTimeFormatSpec = new DateTimeFormatSpec(1, timeType, timeFormat);
-      } else {
-        dateTimeFormatSpec = new DateTimeFormatSpec(1, timeType, timeFormat,
-            _jobConf.get(InternalConfigConstants.SEGMENT_TIME_SDF_PATTERN));
+      switch (timeFormat) {
+        case EPOCH:

Review Comment:
   This should be case SIMPLE_DATE_FORMAT ?



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