Repository navigation
MINOR: [C++][Parquet] Reset page state in RecordReader::SetPageReader - #55384
Closed
professor-moody wants to merge 1 commit into
Closed
professor-moody wants to merge 1 commit into
professor-moody wants to merge 1 commit into
Conversation
professor-moody
requested review from
HuaHuaY,
pitrou and
wgtmac
as code owners
November 3, 2026 21:39
|
Thanks for opening a pull request! This pull request has been automatically closed because you currently have 4 open pull requests, which is more than the limit of 3. Due to the increase in pull requests opened by AI bots, and in order to keep the review queue manageable, Apache Arrow limits contributors without repository access to at most 3 concurrently open pull requests. This helps make sure each pull request gets the attention it needs and that work in progress does not go stale. Once one of your other open pull requests has been merged or closed, you are welcome to reopen this one. See also: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
ColumnChunkReader::SetPageReaderincpp/src/parquet/column_reader.ccclears the current page, the decoders and current_decoder_, but keepsnum_buffered_values_andnum_decoded_values_from the previous page. When aRecordReaderis moved to the next row group before the previous page was read to the end, EnsureDataPage() still sees values left in the old page and does not read a new one, so the nextReadRecordsdecodes with the cleared current_decoder_ and crashes.TypedRecordReaderalso keeps levels that were decoded from the previous column chunk but not consumed yet.parquet::arrow::FileReader reads each row group to the end before calling
SetPageReader, so it is not affected; direct users ofRecordReaderare.What changes are included in this PR?
ColumnChunkReader::SetPageReaderalso resetsnum_buffered_values_andnum_decoded_values_, so the next read starts from the first page of the new column chunk.TypedRecordReader::SetPageReaderdrops the levels betweenlevels_position_andlevels_written()that were decoded from the previous column chunk. Levels that were already consumed are kept.Are these changes tested?
Yes, in
cpp/src/parquet/reader_test.cc, on a file with a required and an optional dictionary-encodedINT32column in two row groups with different values:RecordReaderSetPageReaderAfterFullReadSucceedsreads the first row group to the end, callsSetPageReaderfor the second one and checks thatReadDictionaryandReadRecordsreturn the second row group's dictionary and values.RecordReaderSetPageReaderAfterPartialReadDoesNotReusePagereads 2 of 8 records of the first row group, callsSetPageReaderfor the second one and checks thatReadRecordsreturns the second row group's values.The Parquet reader and Arrow reader/writer test suites pass with the change.
Are there any user-facing changes?
ReadRecordson aRecordReaderreturns the new row group's values afterSetPageReader, also when the previous row group was not read to the end.This PR contains a "Critical Fix". Without it, this call sequence crashes in
ReadRecords.Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by: