From d8b35ef735cc49d36fc0ece98570953d6a610133 Mon Sep 17 00:00:00 2001 From: kunal642 Date: Fri, 21 Sep 2018 18:43:22 +0530 Subject: [PATCH] fix legacy store compatibility issue --- .../blockletindex/BlockDataMap.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockDataMap.java b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockDataMap.java index 8a1538ef44b..0cf99145271 100644 --- a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockDataMap.java +++ b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockDataMap.java @@ -238,6 +238,10 @@ protected DataMapRowImpl loadBlockInfoForOldStore(CarbonRowSchema[] taskSummaryS blockMetaInfo, updatedMinValues, updatedMaxValues, minMaxFlag); } } + List blockletCountList = new ArrayList<>(); + blockletCountList.add((short) 0); + byte[] blockletCount = convertRowCountFromShortToByteArray(blockletCountList); + summaryRow.setByteArray(blockletCount, taskSummarySchema.length - 1); setMinMaxFlagForTaskSummary(summaryRow, taskSummarySchema, segmentProperties, minMaxFlag); return summaryRow; } @@ -627,17 +631,12 @@ protected int getTotalBlocks() { // get total blocklet number in this datamap protected int getTotalBlocklets() { - if (isLegacyStore) { - // dummy value - return 0; - } else { - ByteBuffer byteBuffer = ByteBuffer.wrap(getBlockletRowCountForEachBlock()); - int sum = 0; - while (byteBuffer.hasRemaining()) { - sum += byteBuffer.getShort(); - } - return sum; + ByteBuffer byteBuffer = ByteBuffer.wrap(getBlockletRowCountForEachBlock()); + int sum = 0; + while (byteBuffer.hasRemaining()) { + sum += byteBuffer.getShort(); } + return sum; } private List prune(FilterResolverIntf filterExp) { @@ -1000,7 +999,7 @@ protected CarbonRowSchema[] getTaskSummarySchema() { SegmentPropertiesAndSchemaHolder.getInstance() .getSegmentPropertiesWrapper(segmentPropertiesIndex); try { - return segmentPropertiesWrapper.getTaskSummarySchema(!isLegacyStore, isFilePathStored); + return segmentPropertiesWrapper.getTaskSummarySchema(true, isFilePathStored); } catch (MemoryException e) { throw new RuntimeException(e); }