kfaraz commented on code in PR #16171:
URL: https://github.com/apache/druid/pull/16171#discussion_r1542349469
##########
indexing-service/src/main/java/org/apache/druid/indexing/input/DruidInputSource.java:
##########
@@ -620,4 +622,20 @@ public static List<TimelineObjectHolder<String,
DataSegment>> getTimelineForSegm
return new ArrayList<>(timeline.values());
}
+
+ public int estimateSegmentsCount()
+ {
+ if (segmentIds != null) {
+ return segmentIds.size();
+ }
+
+ Set<SegmentId> ids = new HashSet<>();
+ for (TimelineObjectHolder<String, DataSegment> holder : createTimeline()) {
Review Comment:
`createTimeline()` is a costly operation. Ideally, we should just compute
the number of segments and store it in a field inside the `createTimeline()`
method itself. This way, the field would get computed once as a part of the
normal task flow. We can then read the field whenever needed.
--
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]