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


##########
server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java:
##########
@@ -1202,6 +1238,70 @@ public void testUsedHugeTimeRangeTrickyFilter2() throws 
IOException
     );
   }
 
+
+  @Test
+  public void testEternitySegmentWithStringComparison() throws IOException
+  {
+    coordinator.announceHistoricalSegments(
+        ImmutableSet.of(
+            eternitySegment

Review Comment:
   We should also add a test case with segments with eternity and a segment 
with 2020-Month. 
   Similar comment for other test cases as well. 



##########
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:
   It would be cool if we add the the before and after sample sql statements in 
the PR desc. Would be easy to review the change that way.



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