abhishekagarwal87 commented on a change in pull request #10892:
URL: https://github.com/apache/druid/pull/10892#discussion_r589206011
##########
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 removed unnecessary details and just put that addAll is much more
efficient than add.
----------------------------------------------------------------
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]