You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kr...@apache.org on 2022/02/01 07:09:38 UTC

[hive] branch master updated: HIVE-25893: NPE when reading Parquet data because ColumnVector isNull[] is not updated (Soumyakanti Das, reviewed by Krisztian Kasa)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 27dd6fd  HIVE-25893: NPE when reading Parquet data because ColumnVector isNull[] is not updated (Soumyakanti Das, reviewed by Krisztian Kasa)
27dd6fd is described below

commit 27dd6fdc89b10c8813c02310291b09565f0d4959
Author: Soumyakanti Das <so...@gmail.com>
AuthorDate: Mon Jan 31 23:09:20 2022 -0800

    HIVE-25893: NPE when reading Parquet data because ColumnVector isNull[] is not updated (Soumyakanti Das, reviewed by Krisztian Kasa)
---
 .../parquet/vector/VectorizedListColumnReader.java | 39 ++++++++++++++--------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java b/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java
index 9685e74..4ca363f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java
@@ -414,6 +414,7 @@ public class VectorizedListColumnReader extends BaseVectorizedColumnReader {
       System.arraycopy(((DecimalColumnVector) lcv.child).vector, start,
           ((DecimalColumnVector) resultCV).vector, 0, length);
     }
+    System.arraycopy(lcv.child.isNull, start, resultCV.isNull, 0, length);
     return resultCV;
   }
 
@@ -500,22 +501,34 @@ public class VectorizedListColumnReader extends BaseVectorizedColumnReader {
   private boolean compareBytesColumnVector(BytesColumnVector cv1, BytesColumnVector cv2) {
     int length1 = cv1.vector.length;
     int length2 = cv2.vector.length;
-    if (length1 == length2) {
-      for (int i = 0; i < length1; i++) {
-        int innerLen1 = cv1.vector[i].length;
-        int innerLen2 = cv2.vector[i].length;
-        if (innerLen1 == innerLen2) {
-          for (int j = 0; j < innerLen1; j++) {
-            if (cv1.vector[i][j] != cv2.vector[i][j]) {
-              return false;
-            }
-          }
-        } else {
+    if (length1 != length2) {
+      return false;
+    }
+
+    for (int i = 0; i < length1; i++) {
+      // check for different nulls
+      if (columnVectorsDifferNullForSameIndex(cv1, cv2, i)) {
+        return false;
+      }
+
+      // if they are both null, continue
+      if (cv1.isNull[i] && cv2.isNull[i]) {
+        continue;
+      }
+
+      // check if value lengths are the same
+      int innerLen1 = cv1.vector[i].length;
+      int innerLen2 = cv2.vector[i].length;
+      if (innerLen1 != innerLen2) {
+        return false;
+      }
+
+      // compare value stored
+      for (int j = 0; j < innerLen1; j++) {
+        if (cv1.vector[i][j] != cv2.vector[i][j]) {
           return false;
         }
       }
-    } else {
-      return false;
     }
     return true;
   }