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/01 21:56:45 UTC

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

leventov 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_r261771247
 
 

 ##########
 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 would say that tests are needed to check this value ensures a good uniformity of choosing a segment in a HashMap. 10 might be too little. See [this comment](https://stackoverflow.com/questions/12385284/how-to-select-a-random-key-from-a-hashmap-in-java/54893402#comment96652203_54893402) on SO.

----------------------------------------------------------------
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