siddharthteotia 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_r297853907
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/segment/creator/impl/SegmentColumnarIndexCreator.java
##########
@@ -390,6 +397,43 @@ 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 Object startTime, final Object endTime, final
String segmentName) {
+ if (startTime == null || endTime == null) {
+ throw new RuntimeException("Expecting non-null start/end time for
segment: " + segmentName);
+ }
+
+ long startMillis = 0;
+ long endMillis = 0;
+
+ if (startTime instanceof Long && endTime instanceof Long) {
+ startMillis = (long)startTime;
+ endMillis = (long)endTime;
+ } else if (startTime instanceof Integer && endTime instanceof Integer) {
+ startMillis = ((Integer) startTime).longValue();
+ endMillis = ((Integer) endTime).longValue();
+ } else if (startTime instanceof String && endTime instanceof String) {
+ startMillis = Long.parseLong((String)startTime);
+ endMillis = Long.parseLong((String)endTime);
Review comment:
I am not quite sure about the type comparison. Have some questions on the
format of time that is incoming here at the time of generation v/s how it is
stored. By looking at the code in SegmentMetadataImpl, seems like it is stored
as string and is always parsed as long
----------------------------------------------------------------
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]