sunchao commented on a change in pull request #33695:
URL: https://github.com/apache/spark/pull/33695#discussion_r745213560



##########
File path: 
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java
##########
@@ -204,26 +225,34 @@ void readBatch(int total, WritableColumnVector column) 
throws IOException {
           boolean isUnsignedInt64 = 
updaterFactory.isUnsignedIntTypeMatched(64);
 
           boolean needTransform = castLongToInt || isUnsignedInt32 || 
isUnsignedInt64;
-          column.setDictionary(new ParquetDictionary(dictionary, 
needTransform));
+          values.setDictionary(new ParquetDictionary(dictionary, 
needTransform));
         } else {
-          updater.decodeDictionaryIds(readState.offset - startOffset, 
startOffset, column,
+          updater.decodeDictionaryIds(readState.valueOffset - startOffset, 
startOffset, values,
             dictionaryIds, dictionary);
         }
       } else {
-        if (column.hasDictionary() && readState.offset != 0) {
+        if (values.hasDictionary() && readState.valueOffset != 0) {
           // This batch already has dictionary encoded values but this new 
page is not. The batch
           // does not support a mix of dictionary and not so we will decode 
the dictionary.
-          updater.decodeDictionaryIds(readState.offset, 0, column, 
dictionaryIds, dictionary);
+          updater.decodeDictionaryIds(readState.valueOffset, 0, values, 
dictionaryIds, dictionary);
         }
-        column.setDictionary(null);
+        values.setDictionary(null);
         VectorizedValuesReader valuesReader = (VectorizedValuesReader) 
dataColumn;
-        defColumn.readBatch(readState, column, valuesReader, updater);
+        if (readState.maxRepetitionLevel == 0) {
+          defColumn.readBatch(readState, values, definitionLevels, 
valuesReader, updater);
+        } else {
+          repColumn.readBatchNested(readState, repetitionLevels, defColumn, 
definitionLevels,
+            values, valuesReader, updater);
+        }
       }
     }
   }
 
   private int readPage() {
     DataPage page = pageReader.readPage();
+    if (page == null) {

Review comment:
       Oops sorry @agrawaldevesh just saw your comment.
   
   This could happen when we are reading a repeated column (e.g., an int list). 
In this case, we don't know whether the list is completed or not until we have 
no more page to read.
   
   I think the newer version of `parquet-mr` (since 0.11 I think) no longer 
allow a repeated list to span across multiple pages, but it is allowed in older 
versions.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to