sumitsingh-in commented on code in PR #20183:
URL: https://github.com/apache/hudi/pull/20183#discussion_r4181492161
##########
hudi-spark-datasource/hudi-spark-common/src/main/java/org/apache/spark/sql/execution/datasources/parquet/HoodieVectorizedParquetRecordReader.java:
##########
@@ -94,8 +94,12 @@ public void initBatch(StructType partitionColumns,
InternalRow partitionValues)
@Override
public void close() throws IOException {
super.close();
- for (Map.Entry<Integer, WritableColumnVector> e :
idToColumnVectors.entrySet()) {
- e.getValue().close();
+ // initBatch allocates these vectors. When initialize or initBatch throws,
Spark closes the
+ // reader before they exist, so skip them rather than mask the original
failure with an NPE.
+ if (idToColumnVectors != null) {
Review Comment:
`close()` iterated `idToColumnVectors`, which is only allocated in
`initBatch`. When `initialize` or `initBatch` throws, the version-specific
Parquet readers (Spark 3.3 to 4.2) close the reader in their
catch block (SPARK-23457), and `close()` threw an NPE that replaced the
real error. CI showed only:
```
java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()"
because "this.idToColumnVectors" is null
at
...HoodieVectorizedParquetRecordReader.close(HoodieVectorizedParquetRecordReader.java:97)
--
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]