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/06 21:25:33 UTC

[GitHub] [incubator-druid] leventov commented on a change in pull request #7185: Avoid many unnecessary materializations of collections of 'all segments in cluster' cardinality

leventov commented on a change in pull request #7185: Avoid many unnecessary materializations of collections of 'all segments in cluster' cardinality
URL: https://github.com/apache/incubator-druid/pull/7185#discussion_r263142135
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/metadata/MetadataSegmentManager.java
 ##########
 @@ -59,6 +60,8 @@
 
   Collection<ImmutableDruidDataSource> getDataSources();
 
+  Iterable<DataSegment> iterateAllSegments();
 
 Review comment:
   I intentionally renamed the method to not start with "get". Although formally it returns a lambda whose creation is cheap, iteration itself involves `flatMap()`, creation of many streams, and therefore is not so cheap. 
   
   See item 16 in [checklist](https://docs.google.com/document/d/17EEKT6fih9Dd5NfXjBoECcKbVp1eOB2vb3jKqTF9pPc/edit).
   
   I will add Javadoc to this method to additionally highlight that the iteration is not super cheap (however, far cheaper than materialization to collections that was done before.)

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