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_r303184823
##########
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) {
+ start = (long) startTime;
+ end = (long) endTime;
+ } else if (startTime instanceof String && endTime instanceof String) {
+ start = Long.parseLong((String) startTime);
+ end = Long.parseLong((String) endTime);
+ } else if (startTime instanceof Integer && endTime instanceof Integer) {
+ start = ((Integer) startTime).longValue();
+ end = ((Integer) endTime).longValue();
+ } else {
+ final StringBuilder err = new StringBuilder();
+ err.append("Unable to interpret type of time column value. Failed to
validate start and end time of segment")
+ .append(" uninterpreted type: ")
Review comment:
Could you re-format this file with Pinot check style?
----------------------------------------------------------------
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]