From 267a6cc175736dccb16e8e43abd2772c0f44f611 Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Thu, 7 May 2020 12:39:14 -0700 Subject: [PATCH] low hanging fruit - presize hash map for DruidSegmentReader (#9836) --- .../org/apache/druid/indexing/input/DruidSegmentReader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidSegmentReader.java b/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidSegmentReader.java index f2ce056b770..6460ae43d55 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidSegmentReader.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidSegmentReader.java @@ -21,7 +21,6 @@ package org.apache.druid.indexing.input; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import com.google.common.collect.Maps; import org.apache.druid.data.input.InputEntity; import org.apache.druid.data.input.InputEntity.CleanableFile; import org.apache.druid.data.input.InputRow; @@ -49,6 +48,7 @@ import org.apache.druid.segment.column.ColumnHolder; import org.apache.druid.segment.data.IndexedInts; import org.apache.druid.segment.filter.Filters; import org.apache.druid.segment.realtime.firehose.WindowedStorageAdapter; +import org.apache.druid.utils.CollectionUtils; import org.joda.time.DateTime; import java.io.File; @@ -245,7 +245,8 @@ public class DruidSegmentReader extends IntermediateRowParsingReader theEvent = Maps.newLinkedHashMap(); + final Map theEvent = + CollectionUtils.newLinkedHashMapWithExpectedSize(dimSelectors.size() + metSelectors.size() + 1); for (Entry dimSelector : dimSelectors.entrySet()) { final String dim = dimSelector.getKey();