You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ku...@apache.org on 2019/06/12 07:01:28 UTC

[carbondata] branch master updated: [HOTFIX] Fix compatibility issue with page size

This is an automated email from the ASF dual-hosted git repository.

kunalkapoor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git


The following commit(s) were added to refs/heads/master by this push:
     new 98bd41e  [HOTFIX] Fix compatibility issue with page size
98bd41e is described below

commit 98bd41ef694300c8837019537a0ad4eecd7819d7
Author: ajantha-bhat <aj...@gmail.com>
AuthorDate: Thu Jun 6 12:58:28 2019 +0530

    [HOTFIX] Fix compatibility issue with page size
    
    Problem: Array Out of bound exception when old store is read from latest code.
    Cause: #3239 partially fix the problem, After this change,
     For old store, length is written as zero. so in BlockletInfo,
     numberOfRowsPerPage will be array of zero elements. Hence the ArrayOutOfBound exception.
    Solution: Fill the numberOfRowsPerPage only when length is non-zero,
     when length is zero, it will be filled from setNumberOfRowsPerPage in
     BlockletDataRefNode as numberOfRowsPerPage is null.
    
    This closes #3260
---
 .../apache/carbondata/core/metadata/blocklet/BlockletInfo.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/BlockletInfo.java b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/BlockletInfo.java
index 0d5e6ac..24745e8 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/BlockletInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/BlockletInfo.java
@@ -310,9 +310,13 @@ public class BlockletInfo implements Serializable, Writable {
     if (isSortedPresent) {
       this.isSorted = input.readBoolean();
     }
-    numberOfRowsPerPage = new int[input.readShort()];
-    for (int i = 0; i < numberOfRowsPerPage.length; i++) {
-      numberOfRowsPerPage[i] = input.readInt();
+    short pageCount = input.readShort();
+    if (pageCount != 0) {
+      // should set only for new store, old store will be set via setNumberOfRowsPerPage
+      numberOfRowsPerPage = new int[pageCount];
+      for (int i = 0; i < numberOfRowsPerPage.length; i++) {
+        numberOfRowsPerPage[i] = input.readInt();
+      }
     }
   }