Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[parquet-java] Intermittent out-of-bounds dictionary ID when reading dictionary-encoded Parquet pages

Open
#3,715 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
java

Research direction

Start with PlainValuesDictionary.decodeToInt, DictionaryValuesReader.readInteger, and the ColumnReaderBase call chain shown in the stack trace. Investigate how dictionary IDs are produced while reading dictionary-encoded pages, using the reported 13-entry dictionary and ID 14 as the reference case. Done means the affected pages can be read without an out-of-bounds dictionary access and the intermittent failure is covered by a regression test.

Written by the indexing model from the issue text.

Description

Type: bug
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

Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
4d 12h
Merged PRs (30d)
28

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/parquet-java

All issues in apache/parquet-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.