Repository: incubator-carbondata
Updated Branches:
  refs/heads/master c73e02f20 -> a8ed450bf


fixed variable length filter query with empty data


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

Branch: refs/heads/master
Commit: 0729379a43d72d0e2abd2e15ab3ad5d224faedc6
Parents: c73e02f
Author: vpp9380 <vpp9...@gmail.com>
Authored: Sat Apr 15 17:01:48 2017 +0530
Committer: Venkata Ramana G <ramana.gollam...@huawei.com>
Committed: Sat Apr 15 22:18:42 2017 +0530

----------------------------------------------------------------------
 .../UnsafeVariableLengthDimesionDataChunkStore.java       | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/0729379a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/impl/unsafe/UnsafeVariableLengthDimesionDataChunkStore.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/impl/unsafe/UnsafeVariableLengthDimesionDataChunkStore.java
 
b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/impl/unsafe/UnsafeVariableLengthDimesionDataChunkStore.java
index f5222fe..2b84449 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/impl/unsafe/UnsafeVariableLengthDimesionDataChunkStore.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/impl/unsafe/UnsafeVariableLengthDimesionDataChunkStore.java
@@ -171,7 +171,7 @@ public class UnsafeVariableLengthDimesionDataChunkStore
   /**
    * to compare the two byte array
    *
-   * @param index        index of first byte array
+   * @param index index of first byte array
    * @param compareValue value of to be compared
    * @return compare result
    */
@@ -199,20 +199,20 @@ public class UnsafeVariableLengthDimesionDataChunkStore
     }
     // as this class handles this variable length data, so filter value can be
     // smaller or bigger than than actual data, so we need to take the smaller 
length
-    int compareResult = 0;
-    int compareLength = length < compareValue.length ? length : 
compareValue.length;
+    int compareResult;
+    int compareLength = Math.min(length , compareValue.length);
     for (int i = 0; i < compareLength; i++) {
       compareResult = 
(CarbonUnsafe.unsafe.getByte(dataPageMemoryBlock.getBaseObject(),
           dataPageMemoryBlock.getBaseOffset() + currentDataOffset) & 0xff) - 
(compareValue[i]
           & 0xff);
       // if compare result is not equal we can break
       if (compareResult != 0) {
-        break;
+        return compareResult;
       }
       // increment the offset by one as comparison is done byte by byte
       currentDataOffset++;
     }
-    return compareResult;
+    return length - compareValue.length;
   }
 
 }

Reply via email to