kfaraz commented on code in PR #17653:
URL: https://github.com/apache/druid/pull/17653#discussion_r1947547182
##########
server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataQuery.java:
##########
@@ -149,6 +153,82 @@ public CloseableIterator<DataSegment> retrieveUsedSegments(
);
}
+ public CloseableIterator<DataSegmentPlus> retrieveUsedSegmentsPlus(
+ String dataSource,
+ Collection<Interval> intervals
+ )
+ {
+ return retrieveSegmentsPlus(
+ dataSource,
+ intervals, null, IntervalMode.OVERLAPS, true, null, null, null, null
+ );
+ }
+
+ /**
+ * Determines the highest ID amongst unused segments for the given
datasource,
+ * interval and version.
+ *
+ * @return null if no unused segment exists for the given parameters.
+ */
+ @Nullable
+ public SegmentId retrieveHighestUnusedSegmentId(
+ String datasource,
+ Interval interval,
+ String version
+ )
+ {
+ final Set<String> unusedSegmentIds =
+ retrieveUnusedSegmentIdsForExactIntervalAndVersion(datasource,
interval, version);
+ log.debug(
+ "Found [%,d] unused segments for datasource[%s] for interval[%s] and
version[%s].",
+ unusedSegmentIds.size(), datasource, interval, version
+ );
+
+ SegmentId unusedMaxId = null;
+ int maxPartitionNum = -1;
+ for (String id : unusedSegmentIds) {
+ final SegmentId segmentId = SegmentId.tryParse(datasource, id);
+ if (segmentId == null) {
Review Comment:
Fixed, throws exception now.
--
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]