Describe the bug, including details regarding any error messages, version, and platform.
Description
We intermittently encounter a ParquetDecodingException when reading Parquet files written by Apache Hudi with Spark.
The issue cannot be reproduced consistently for every write, but it has occurred repeatedly across different write jobs.
The failures have a similar call chain: while reading a dictionary-encoded data page, parquet-java decodes a dictionary ID that is outside the range of the current dictionary. PlainValuesDictionary then attempts to access the dictionary array with that ID and throws an ArrayIndexOutOfBoundsException.
In the representative case below, the affected column is:
optional int32 chan_second_cate_cd
The dictionary contains 13 entries, so the valid dictionary IDs are 0 through 12. However, the data page produces dictionary ID 14, resulting in:
java.lang.ArrayIndexOutOfBoundsException: Index 14 out of bounds for length 13
This failure occurs in row group 0, at column value 292293 out of 478848, and at value 12293 out of 20000 in the current data page.
The value 14 is an internal Parquet dictionary ID, not the actual value stored in the column.
Environment
| Component |
Version |
| Apache Hudi |
0.13.1 |
| Write engine |
Apache Spark 3.4 |
| parquet-mr |
1.12.3 |
Representative Stack Trace
Click to expand
org.apache.parquet.io.ParquetDecodingException: Can not read value at 292293 in block 0 in file <sanitized-parquet-file-path>
at org.apache.parquet.hadoop.InternalParquetRecordReader.nextKeyValue(InternalParquetRecordReader.java:264)
at org.apache.parquet.hadoop.ParquetRecordReader.nextKeyValue(ParquetRecordReader.java:207)
at org.apache.spark.sql.execution.datasources.RecordReaderIterator.hasNext(RecordReaderIterator.scala:39)
at org.apache.spark.sql.execution.datasources.RecordReaderIterator$$anon$1.hasNext(RecordReaderIterator.scala:61)
at org.apache.spark.sql.execution.datasources.FileScanRDD$$anon$1.hasNext(FileScanRDD.scala:125)
at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:460)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIteratorForCodegenStage1.processNext(Unknown Source)
at org.apache.spark.sql.execution.BufferedRowIterator.hasNext(BufferedRowIterator.java:43)
at org.apache.spark.sql.execution.WholeStageCodegenExec$$anon$1.hasNext(WholeStageCodegenExec.scala:760)
at org.apache.spark.shuffle.sort.BypassMergeSortShuffleWriter.write(BypassMergeSortShuffleWriter.java:140)
at org.apache.spark.shuffle.ShuffleWriteProcessor.write(ShuffleWriteProcessor.scala:59)
at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:101)
at org.apache.spark.scheduler.Task.run(Task.scala:140)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:565)
Caused by: org.apache.parquet.io.ParquetDecodingException: Can't read value in column [chan_second_cate_cd] optional int32 chan_second_cate_cd at value 292293 out of 478848, 12293 out of 20000 in currentPage. repetition level: 0, definition level: 1
at org.apache.parquet.column.impl.ColumnReaderBase.readValue(ColumnReaderBase.java:553)
at org.apache.parquet.column.impl.ColumnReaderImpl.readValue(ColumnReaderImpl.java:30)
at org.apache.parquet.column.impl.ColumnReaderBase.writeCurrentValueToConverter(ColumnReaderBase.java:439)
at org.apache.parquet.column.impl.ColumnReaderImpl.writeCurrentValueToConverter(ColumnReaderImpl.java:30)
at org.apache.parquet.io.RecordReaderImplementation.read(RecordReaderImplementation.java:406)
at org.apache.parquet.hadoop.InternalParquetRecordReader.nextKeyValue(InternalParquetRecordReader.java:234)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 14 out of bounds for length 13
at org.apache.parquet.column.values.dictionary.PlainValuesDictionary$PlainIntegerDictionary.decodeToInt(PlainValuesDictionary.java:251)
at org.apache.parquet.column.values.dictionary.DictionaryValuesReader.readInteger(DictionaryValuesReader.java:108)
at org.apache.parquet.column.impl.ColumnReaderBase$2$3.read(ColumnReaderBase.java:279)
at org.apache.parquet.column.impl.ColumnReaderBase.readValue(ColumnReaderBase.java:533)
Component(s)
No response
Describe the bug, including details regarding any error messages, version, and platform.
Description
We intermittently encounter a
ParquetDecodingExceptionwhen reading Parquet files written by Apache Hudi with Spark.The issue cannot be reproduced consistently for every write, but it has occurred repeatedly across different write jobs.
The failures have a similar call chain: while reading a dictionary-encoded data page, parquet-java decodes a dictionary ID that is outside the range of the current dictionary.
PlainValuesDictionarythen attempts to access the dictionary array with that ID and throws anArrayIndexOutOfBoundsException.In the representative case below, the affected column is:
The dictionary contains 13 entries, so the valid dictionary IDs are
0through12. However, the data page produces dictionary ID14, resulting in:This failure occurs in row group
0, at column value292293out of478848, and at value12293out of20000in the current data page.The value
14is an internal Parquet dictionary ID, not the actual value stored in the column.Environment
0.13.13.41.12.3Representative Stack Trace
Click to expand
Component(s)
No response