carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [3/7] incubator-carbondata git commit: Fixed NullPointerException for Null values in carbon table when querying from Presto
Date Fri, 31 Mar 2017 05:20:07 GMT
Fixed NullPointerException for Null values in carbon table when querying from Presto


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

Branch: refs/heads/branch-1.1
Commit: a07d7714fbdc852bc19e0129b5780cc0890f3298
Parents: 436bc95
Author: Bhavya <bhavya@knoldus.com>
Authored: Thu Mar 30 13:22:55 2017 +0530
Committer: chenliang613 <chenliang613@huawei.com>
Committed: Thu Mar 30 19:59:06 2017 +0530

----------------------------------------------------------------------
 .../presto/CarbondataRecordCursor.java           | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/a07d7714/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataRecordCursor.java
----------------------------------------------------------------------
diff --git a/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataRecordCursor.java
b/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataRecordCursor.java
index 3314ac4..8eef1c9 100755
--- a/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataRecordCursor.java
+++ b/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataRecordCursor.java
@@ -26,6 +26,7 @@ import io.airlift.slice.Slices;
 import org.apache.carbondata.common.CarbonIterator;
 import org.apache.carbondata.hadoop.readsupport.CarbonReadSupport;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -84,10 +85,20 @@ public class CarbondataRecordCursor implements RecordCursor {
     }
 
     if (rowCursor.hasNext()) {
-      fields = Stream.of(readSupport.readRow(rowCursor.next())).map(a -> a.toString())
-          .collect(Collectors.toList());
-
-      totalBytes += fields.size();
+      Object[] columns = readSupport.readRow(rowCursor.next());
+      fields = new ArrayList<String>();
+      if(columns != null && columns.length > 0)
+      {
+        for(Object value : columns){
+          if(value != null )
+          {
+            fields.add(value.toString());
+          } else {
+            fields.add(null);
+          }
+        }
+      }
+      totalBytes += columns.length;
       return true;
     }
     return false;


Mime
View raw message