This is an automated email from the ASF dual-hosted git repository.
cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 2b24dc3 SegmentAnalyzer: Properly close column after retrieving it.
(#10772)
2b24dc3 is described below
commit 2b24dc3764faf3aa42dd682941e1d28754d96790
Author: Gian Merlino <[email protected]>
AuthorDate: Sat Jan 16 19:26:34 2021 -0800
SegmentAnalyzer: Properly close column after retrieving it. (#10772)
---
.../apache/druid/query/metadata/SegmentAnalyzer.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git
a/processing/src/main/java/org/apache/druid/query/metadata/SegmentAnalyzer.java
b/processing/src/main/java/org/apache/druid/query/metadata/SegmentAnalyzer.java
index 2388004..206ad2c 100644
---
a/processing/src/main/java/org/apache/druid/query/metadata/SegmentAnalyzer.java
+++
b/processing/src/main/java/org/apache/druid/query/metadata/SegmentAnalyzer.java
@@ -37,6 +37,7 @@ import org.apache.druid.segment.QueryableIndex;
import org.apache.druid.segment.Segment;
import org.apache.druid.segment.StorageAdapter;
import org.apache.druid.segment.VirtualColumns;
+import org.apache.druid.segment.column.BaseColumn;
import org.apache.druid.segment.column.BitmapIndex;
import org.apache.druid.segment.column.ColumnCapabilities;
import org.apache.druid.segment.column.ColumnCapabilitiesImpl;
@@ -52,6 +53,7 @@ import org.joda.time.DateTime;
import org.joda.time.Interval;
import javax.annotation.Nullable;
+import java.io.IOException;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Map;
@@ -231,11 +233,16 @@ public class SegmentAnalyzer
}
} else if (capabilities.isDictionaryEncoded().isTrue()) {
// fallback if no bitmap index
- DictionaryEncodedColumn<String> theColumn =
(DictionaryEncodedColumn<String>) columnHolder.getColumn();
- cardinality = theColumn.getCardinality();
- if (analyzingMinMax() && cardinality > 0) {
- min = NullHandling.nullToEmptyIfNeeded(theColumn.lookupName(0));
- max =
NullHandling.nullToEmptyIfNeeded(theColumn.lookupName(cardinality - 1));
+ try (BaseColumn column = columnHolder.getColumn()) {
+ DictionaryEncodedColumn<String> theColumn =
(DictionaryEncodedColumn<String>) column;
+ cardinality = theColumn.getCardinality();
+ if (analyzingMinMax() && cardinality > 0) {
+ min = NullHandling.nullToEmptyIfNeeded(theColumn.lookupName(0));
+ max =
NullHandling.nullToEmptyIfNeeded(theColumn.lookupName(cardinality - 1));
+ }
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
}
} else {
cardinality = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]