You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/03/04 01:01:21 UTC

[GitHub] [incubator-druid] shivtools commented on a change in pull request #7174: Change reservoir sampling of segments to spliterator approach

shivtools commented on a change in pull request #7174: Change reservoir sampling of segments to spliterator approach
URL: https://github.com/apache/incubator-druid/pull/7174#discussion_r261899405
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/server/coordinator/ReservoirSegmentSampler.java
 ##########
 @@ -21,36 +21,57 @@
 
 import org.apache.druid.timeline.DataSegment;
 
+import java.util.Collection;
 import java.util.List;
+import java.util.Spliterator;
 import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
 
 final class ReservoirSegmentSampler
 {
+  final static int SPLITERATOR_SIZE_THRESHOLD = 10;
 
 Review comment:
   I ran some benchmarks by hand and observed that `25` resulted in the most uniform selection of segments. See results in this [Gist](https://gist.github.com/shivtools/7e8af2038e155e2cd8131a10f53035a5).
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org