maytasm commented on a change in pull request #10892:
URL: https://github.com/apache/druid/pull/10892#discussion_r586956807
##########
File path:
server/src/main/java/org/apache/druid/client/CachingClusteredClient.java
##########
@@ -856,4 +845,50 @@ String computeResultLevelCachingEtag(
return strategy.computeCacheKey(query);
}
}
+
+ private static class TimelineConverter implements
UnaryOperator<TimelineLookup<String, ServerSelector>>
+ {
+ private final Iterable<SegmentDescriptor> specs;
+
+ TimelineConverter(final Iterable<SegmentDescriptor> specs)
+ {
+ this.specs = specs;
+ }
+
+ @Override
+ public TimelineLookup<String, ServerSelector> apply(TimelineLookup<String,
ServerSelector> timeline)
+ {
+ final VersionedIntervalTimeline<String, ServerSelector> timeline2 =
+ new VersionedIntervalTimeline<>(Ordering.natural());
+ Iterator<PartitionChunkEntry<String, ServerSelector>> unfilteredIterator
=
+ Iterators.transform(specs.iterator(), spec -> toChunkEntry(timeline,
spec));
+ Iterator<PartitionChunkEntry<String, ServerSelector>> iterator =
Iterators.filter(
+ unfilteredIterator,
+ Objects::nonNull
+ );
+ // We add all the entries via batch add to avoid overhead of single add
call. The call to add an entry to interval
Review comment:
I think the comment can be a little more clear in mentioning that by
avoiding to call add n times and calling addAll once reduces O(n)*n to O(n)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]