This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch release-0.3.0 in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
commit e66df48e449b025ff42e98c1b06a6090be7c27b7 Author: Jialiang Li <[email protected]> AuthorDate: Fri Mar 6 17:56:52 2020 -0800 Fix default value for dictionary byte column (#5123) * Fix default value for no dictionary byte column --- .../apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java | 6 +++--- .../main/java/org/apache/pinot/core/minion/RawIndexConverter.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java index 2698855..0dc772a 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java @@ -208,10 +208,10 @@ public class MutableSegmentImpl implements MutableSegment { // each forward index entry will contain a 4 byte dictionary ID forwardIndexColumnSize = FieldSpec.DataType.INT.size(); int dictionaryColumnSize; - if (dataType == FieldSpec.DataType.STRING) { - dictionaryColumnSize = _statsHistory.getEstimatedAvgColSize(column); - } else { + if (isFixedWidthColumn) { dictionaryColumnSize = dataType.size(); + } else { + dictionaryColumnSize = _statsHistory.getEstimatedAvgColSize(column); } // NOTE: preserve 10% buffer for cardinality to reduce the chance of re-sizing the dictionary int estimatedCardinality = (int) (_statsHistory.getEstimatedCardinality(column) * 1.1); diff --git a/pinot-core/src/main/java/org/apache/pinot/core/minion/RawIndexConverter.java b/pinot-core/src/main/java/org/apache/pinot/core/minion/RawIndexConverter.java index 64baa46..9d5a484 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/minion/RawIndexConverter.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/minion/RawIndexConverter.java @@ -165,10 +165,10 @@ public class RawIndexConverter { // In bits int lengthOfEachEntry; - if (dataType.equals(FieldSpec.DataType.STRING)) { - lengthOfEachEntry = columnMetadata.getColumnMaxLength() * Byte.SIZE; - } else { + if (dataType.isFixedWidth()) { lengthOfEachEntry = dataType.size() * Byte.SIZE; + } else { + lengthOfEachEntry = columnMetadata.getColumnMaxLength() * Byte.SIZE; } long dictionaryBasedIndexSize = (long) numTotalDocs * columnMetadata.getBitsPerElement() + (long) cardinality * lengthOfEachEntry; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
