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 2021/03/17 10:33:10 UTC

[GitHub] [druid] abhishekagarwal87 commented on a change in pull request #11008: Improve performance of queries against SYSTEM.SEGMENT table.

abhishekagarwal87 commented on a change in pull request #11008:
URL: https://github.com/apache/druid/pull/11008#discussion_r595894211



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/schema/DruidSchema.java
##########
@@ -702,13 +702,14 @@ private static RowSignature analysisToRowSignature(final SegmentAnalysis analysi
 
   Map<SegmentId, AvailableSegmentMetadata> getSegmentMetadataSnapshot()
   {
-    final Map<SegmentId, AvailableSegmentMetadata> segmentMetadata = new HashMap<>();
     synchronized (lock) {
+      final Map<SegmentId, AvailableSegmentMetadata> segmentMetadata = Maps.newHashMapWithExpectedSize(
+          segmentMetadataInfo.values().size());

Review comment:
       should this be `segmentMetadataInfo.values().stream().mapToInt(v -> v.size()).sum()` ?




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



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