carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [10/15] carbondata git commit: [CARBONDATA-1306] Fixed carbondata crash after using short-int datatype
Date Mon, 17 Jul 2017 01:56:56 GMT
[CARBONDATA-1306] Fixed carbondata crash after using short-int datatype

This closes #1171


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/5b49afcf
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/5b49afcf
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/5b49afcf

Branch: refs/heads/datamap
Commit: 5b49afcfa67a1b3c822a2182e0fdbed813c5c2d0
Parents: c7f0b10
Author: Ravindra Pesala <ravi.pesala@gmail.com>
Authored: Thu Jul 13 16:42:08 2017 +0530
Committer: jackylk <jacky.likun@huawei.com>
Committed: Thu Jul 13 19:34:43 2017 +0800

----------------------------------------------------------------------
 .../carbondata/core/datastore/page/UnsafeFixLengthColumnPage.java | 2 +-
 .../org/apache/carbondata/core/metadata/datatype/DataType.java    | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/5b49afcf/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeFixLengthColumnPage.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeFixLengthColumnPage.java
b/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeFixLengthColumnPage.java
index 2382599..3df91a3 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeFixLengthColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeFixLengthColumnPage.java
@@ -367,7 +367,7 @@ public class UnsafeFixLengthColumnPage extends ColumnPage {
   public byte[] compress(Compressor compressor) throws MemoryException, IOException {
     if (UnsafeMemoryManager.isOffHeap()) {
       // use raw compression and copy to byte[]
-      int inputSize = pageSize << dataType.getSizeBits();
+      int inputSize = pageSize * dataType.getSizeInBytes();
       int compressedMaxSize = compressor.maxCompressedLength(inputSize);
       MemoryBlock compressed = UnsafeMemoryManager.allocateMemoryWithRetry(compressedMaxSize);
       long outSize = compressor.rawCompress(baseOffset, inputSize, compressed.getBaseOffset());

http://git-wip-us.apache.org/repos/asf/carbondata/blob/5b49afcf/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
b/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
index 3a7f75d..e97cce0 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
@@ -69,6 +69,9 @@ public enum DataType {
   }
 
   public int getSizeBits() {
+    if (this == SHORT_INT) {
+      throw new UnsupportedOperationException("Should not call this from datatype " + SHORT_INT);
+    }
     return (int) (Math.log(getSizeInBytes()) / Math.log(2));
   }
 


Mime
View raw message