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

ajantha 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 d850c95  [CARBONDATA-3905] NPE due to null length while querying in 
Presto
d850c95 is described below

commit d850c959962f577f6169d7c7e7032a630678e6bd
Author: akkio-97 <akshay.nuth...@gmail.com>
AuthorDate: Wed Nov 4 16:34:15 2020 +0530

    [CARBONDATA-3905] NPE due to null length while querying in Presto
    
    Why is this PR needed?
    Earlier the implementation of putAllByteArray() in class SliceStreamReader 
was added with regards to handling of complex string type columns. This method 
is also called in case of plain string type.
    While querying plain string type the lengths may be equal to null. Hence 
this check has been added.
    
    What changes were proposed in this PR?
    Handled the same
    
    Does this PR introduce any user interface change?
    No
    
    Is any new testcase added?
    No
    
    This closes #4003
---
 .../org/apache/carbondata/presto/readers/SliceStreamReader.java         | 2 ++
 .../org/apache/carbondata/presto/readers/SliceStreamReader.java         | 2 ++
 2 files changed, 4 insertions(+)

diff --git 
a/integration/presto/src/main/prestodb/org/apache/carbondata/presto/readers/SliceStreamReader.java
 
b/integration/presto/src/main/prestodb/org/apache/carbondata/presto/readers/SliceStreamReader.java
index 59d68dc..497b5cd 100644
--- 
a/integration/presto/src/main/prestodb/org/apache/carbondata/presto/readers/SliceStreamReader.java
+++ 
b/integration/presto/src/main/prestodb/org/apache/carbondata/presto/readers/SliceStreamReader.java
@@ -141,8 +141,10 @@ public class SliceStreamReader extends 
CarbonColumnVectorImpl implements PrestoV
 
   @Override
   public void putAllByteArray(byte[] data, int offset, int length) {
+    super.putAllByteArray(data, offset, length);
     int[] lengths = getLengths();
     int[] offsets = getOffsets();
+    if (lengths == null) return;
     for (int i = 0; i < lengths.length; i++) {
       if (offsets[i] != 0) {
         putByteArray(i, offsets[i], lengths[i], data);
diff --git 
a/integration/presto/src/main/prestosql/org/apache/carbondata/presto/readers/SliceStreamReader.java
 
b/integration/presto/src/main/prestosql/org/apache/carbondata/presto/readers/SliceStreamReader.java
index 41a7541..4eeb331 100644
--- 
a/integration/presto/src/main/prestosql/org/apache/carbondata/presto/readers/SliceStreamReader.java
+++ 
b/integration/presto/src/main/prestosql/org/apache/carbondata/presto/readers/SliceStreamReader.java
@@ -141,8 +141,10 @@ public class SliceStreamReader extends 
CarbonColumnVectorImpl implements PrestoV
 
   @Override
   public void putAllByteArray(byte[] data, int offset, int length) {
+    super.putAllByteArray(data, offset, length);
     int[] lengths = getLengths();
     int[] offsets = getOffsets();
+    if (lengths == null) return;
     for (int i = 0; i < lengths.length; i++) {
       if (offsets[i] != 0) {
         putByteArray(i, offsets[i], lengths[i], data);

Reply via email to