jackjlli commented on a change in pull request #4368: 3891: Check for validity
of segment start/end time during segment generation
URL: https://github.com/apache/incubator-pinot/pull/4368#discussion_r303181057
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/SegmentColumnarIndexCreator.java
##########
@@ -391,6 +399,134 @@ void writeMetadata()
properties.save();
}
+ /**
+ * Check for the validity of segment start and end time
+ * @param startTime segment start time
+ * @param endTime segment end time
+ * @param segmentName segment name
+ */
+ private void checkTime(final SegmentGeneratorConfig config, final Object
startTime, final Object endTime,
+ final String segmentName) {
+ if (!config.isCheckTimeColumnValidityDuringGeneration()) {
+ return;
+ }
+
+ if (startTime == null || endTime == null) {
+ throw new RuntimeException("Expecting non-null start/end time for
segment: " + segmentName);
+ }
+
+ long start;
+ long end;
+
+ if (startTime instanceof Long && endTime instanceof Long) {
Review comment:
I'm thinking whether we can firstly check `startTime` ad `endTime` are of
the same class, then use switch block to differentiate the cases on either one
of the objects. By doing so we don't need to keep a list of `if else block`
here. But you can decide.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]