GH-3411 Expose row group index via Parquet reader#3412
Open
uros7251brick wants to merge 1 commit intoapache:masterfrom
Open
GH-3411 Expose row group index via Parquet reader#3412uros7251brick wants to merge 1 commit intoapache:masterfrom
uros7251brick wants to merge 1 commit intoapache:masterfrom
Conversation
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
Engines like Apache Spark need to know which row group a record belongs to — for example, to expose row group metadata as a hidden column, or to correlate records with row group-level statistics. Without this API, callers have no way to determine the current row group index during sequential reads.
What changes are included in this PR?
Similar to how
getCurrentRowIndex()was introduced to expose the current row's file-level index, this addsgetCurrentRowGroupIndex()to expose the index of the row group currently being read.New API:
ParquetFileReader.getCurrentRowGroupIndex()— returns the 0-based index of the last row group read viareadNextRowGroup() / readNextFilteredRowGroup(). Returns -1 before any row group has been read.ParquetReader.getCurrentRowGroupIndex()— same semantics, for the high-level record reader.ParquetRecordReader.getCurrentRowGroupIndex()— same, for the Hadoop MapReduce record reader.The returned index is the actual file-level row group index, meaning it correctly reflects gaps when empty row groups are skipped (e.g. if row group 1 is empty, the indices reported will be 0, 2, ... not 0, 1, ...).
Are these changes tested?
Yes.
Are there any user-facing changes?
No.
Closes #3411