[ 
https://issues.apache.org/jira/browse/HIVE-25893?focusedWorklogId=715457&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-715457
 ]

ASF GitHub Bot logged work on HIVE-25893:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Jan/22 06:07
            Start Date: 26/Jan/22 06:07
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on a change in pull request #2970:
URL: https://github.com/apache/hive/pull/2970#discussion_r792335168



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java
##########
@@ -500,22 +501,37 @@ private boolean 
compareDecimalColumnVector(DecimalColumnVector cv1, DecimalColum
   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
+      // else if one of them is null, return false
+      if (cv1.isNull[i] && cv2.isNull[i]) {
+        continue;
+      } else if (cv1.isNull[i] || cv2.isNull[i]) {

Review comment:
       This check seems to be unnecessary because it is already handled by 
   ```
        if (columnVectorsDifferNullForSameIndex(cv1, cv2, i)) {
           return false;
        }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 715457)
    Time Spent: 0.5h  (was: 20m)

> NPE when reading Parquet data because ColumnVector isNull[] is not updated
> --------------------------------------------------------------------------
>
>                 Key: HIVE-25893
>                 URL: https://issues.apache.org/jira/browse/HIVE-25893
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Soumyakanti Das
>            Assignee: Soumyakanti Das
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In 
> [VectorizedListColumnReader.java|https://github.com/apache/hive/blob/595f3bc9d612f02581bd3377ee0107efd6553ae6/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java]
>  {{isNull[]}} is used in the comparison methods ( eg. 
> [columnVectorsDifferNullForSameIndex 
> |https://github.com/apache/hive/blob/595f3bc9d612f02581bd3377ee0107efd6553ae6/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java#L524]
>  ), however, {{isNull}} is always {{false}} as it is never updated in 
> [getChildData|https://github.com/apache/hive/blob/595f3bc9d612f02581bd3377ee0107efd6553ae6/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedListColumnReader.java#L401].
>  This could result in NullPointerException like,
> {code}
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedListColumnReader.compareBytesColumnVector(VectorizedListColumnReader.java:506)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedListColumnReader.compareColumnVector(VectorizedListColumnReader.java:432)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedListColumnReader.setIsRepeating(VectorizedListColumnReader.java:367)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedListColumnReader.convertValueListToListColumnVector(VectorizedListColumnReader.java:360)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedListColumnReader.readBatch(VectorizedListColumnReader.java:83)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedMapColumnReader.readBatch(VectorizedMapColumnReader.java:57)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.nextBatch(VectorizedParquetRecordReader.java:438)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.next(VectorizedParquetRecordReader.java:377)
>       at 
> org.apache.hadoop.hive.ql.io.parquet.vector.VectorizedParquetRecordReader.next(VectorizedParquetRecordReader.java:100)
>       at 
> org.apache.hadoop.hive.ql.io.HiveContextAwareRecordReader.doNext(HiveContextAwareRecordReader.java:375)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to