adarshsanjeev commented on code in PR #12844:
URL: https://github.com/apache/druid/pull/12844#discussion_r936555196


##########
server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataQuery.java:
##########
@@ -233,12 +233,24 @@ private CloseableIterator<DataSegment> retrieveSegments(
             )
         );
 
-        if (i == intervals.size() - 1) {
-          sb.append(")");
-        } else {
+        // Add a special check for a segment which have one end at eternity 
and the other at some finite value. Since
+        // we are using string comparison, a segment with this start or end 
will not be returned otherwise.
+        if (matchMode.equals(IntervalMode.OVERLAPS)) {
+          sb.append(StringUtils.format(" OR (start = '%s' AND \"end\" != '%s' 
AND \"end\" > :start%d)", Intervals.ETERNITY.getStart(), 
Intervals.ETERNITY.getEnd(), i));

Review Comment:
   Good idea! Done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to