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/10/13 22:03:43 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #9505: Allow batch segments to have invalid start/end time

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


##########
pinot-controller/src/test/java/org/apache/pinot/controller/utils/SegmentMetadataMockUtils.java:
##########
@@ -46,12 +46,13 @@ public static SegmentMetadata mockSegmentMetadata(String tableName, String segme
     Mockito.when(segmentMetadata.getName()).thenReturn(segmentName);
     Mockito.when(segmentMetadata.getTotalDocs()).thenReturn(numTotalDocs);
     Mockito.when(segmentMetadata.getCrc()).thenReturn(crc);
-    Mockito.when(segmentMetadata.getStartTime()).thenReturn(1L);
-    Mockito.when(segmentMetadata.getEndTime()).thenReturn(10L);
+    Mockito.when(segmentMetadata.getTimeColumn()).thenReturn(tableName);

Review Comment:
   (minor) Put a dummy time column name such as `"timeCol"`, same for line 105



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/SegmentColumnarIndexCreator.java:
##########
@@ -758,18 +768,20 @@ private void writeMetadata()
           }
         }
 
+        Interval timeInterval =
+            new Interval(timeUnit.toMillis(startTime), timeUnit.toMillis(endTime), DateTimeZone.UTC);
+        boolean isValidTimeInterval = TimeUtils.isValidTimeInterval(timeInterval);
         if (!_config.isSkipTimeValueCheck()) {

Review Comment:
   (minor) Suggest changing the check order a little bit and log a warning when time interval is not valid, but time value check is skipped
   ```suggestion
           if (isValidTimeInterval) {
             setSegmentTimeInterval(properties, startTime, endTime, timeUnit);
           } else {
             if (_config.isSkipTimeValueCheck()) {
               LOGGER.warn(...);
             } else {
               throw new IllegalStateException(...);
             }
           }
   ```



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