zachjsh commented on code in PR #15415:
URL: https://github.com/apache/druid/pull/15415#discussion_r1422926420


##########
server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java:
##########
@@ -955,6 +956,50 @@ public Optional<Iterable<DataSegment>> 
iterateAllUsedNonOvershadowedSegmentsForD
                    .transform(timeline -> 
timeline.findNonOvershadowedObjectsInInterval(interval, 
Partitions.ONLY_COMPLETE));
   }
 
+  /**
+   * Retrieves segments for a given datasource that are marked unused and that 
are *fully contained by* an optionally
+   * specified interval. If the interval specified is null, this method will 
retrieve all unused segments.
+   *
+   * This call does not return any information about realtime segments.
+   *
+   * @param datasource      The name of the datasource
+   * @param interval        The intervals to search over

Review Comment:
   fixed



##########
server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java:
##########
@@ -1206,23 +1206,86 @@ public void 
testRetrieveUnusedSegmentsUsingMultipleIntervalsAndNoLimit() throws
     final List<DataSegment> segments = createAndGetUsedYearSegments(1900, 
2133);
     markAllSegmentsUnused(new HashSet<>(segments));
 
-    final ImmutableList<DataSegment> actualUnusedSegments = 
retrieveUnusedSegmentsUsingMultipleIntervalsAndLimit(
+    final ImmutableList<DataSegment> actualUnusedSegments = 
retrieveUnusedSegmentsUsingMultipleIntervalsLimitAndOffset(
         
segments.stream().map(DataSegment::getInterval).collect(Collectors.toList()),
+        null,
+        null,
+        null
+    );
+    Assert.assertEquals(segments.size(), actualUnusedSegments.size());
+    Assert.assertTrue(segments.containsAll(actualUnusedSegments));
+  }
+
+  @Test
+  public void testRetrieveUnusedSegmentsUsingNoIntervalsNoLimitNoOffset() 
throws IOException
+  {
+    final List<DataSegment> segments = createAndGetUsedYearSegments(1900, 
2133);
+    markAllSegmentsUnused(new HashSet<>(segments));
+
+    final ImmutableList<DataSegment> actualUnusedSegments = 
retrieveUnusedSegmentsUsingMultipleIntervalsLimitAndOffset(
+        ImmutableList.of(),
+        null,
+        null,
         null
     );
     Assert.assertEquals(segments.size(), actualUnusedSegments.size());
     Assert.assertTrue(segments.containsAll(actualUnusedSegments));
   }
 
+  @Test
+  public void testRetrieveUnusedSegmentsUsingNoIntervalsAndNoLimitAndOffset() 
throws IOException

Review Comment:
   fixed



##########
server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java:
##########
@@ -1206,23 +1206,86 @@ public void 
testRetrieveUnusedSegmentsUsingMultipleIntervalsAndNoLimit() throws
     final List<DataSegment> segments = createAndGetUsedYearSegments(1900, 
2133);
     markAllSegmentsUnused(new HashSet<>(segments));
 
-    final ImmutableList<DataSegment> actualUnusedSegments = 
retrieveUnusedSegmentsUsingMultipleIntervalsAndLimit(
+    final ImmutableList<DataSegment> actualUnusedSegments = 
retrieveUnusedSegmentsUsingMultipleIntervalsLimitAndOffset(
         
segments.stream().map(DataSegment::getInterval).collect(Collectors.toList()),
+        null,
+        null,
+        null
+    );
+    Assert.assertEquals(segments.size(), actualUnusedSegments.size());
+    Assert.assertTrue(segments.containsAll(actualUnusedSegments));
+  }
+
+  @Test
+  public void testRetrieveUnusedSegmentsUsingNoIntervalsNoLimitNoOffset() 
throws IOException

Review Comment:
   fixed



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