Skip to content

[Parquet] Support returning RowGroupIndex as a column #8641

Closed

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Based on a discord thread

@adriangb suggests it would be very useful to be able to get row groups out of a parquet scan, to for example build secondary indexes at the row group level.

For example it would be really nice to compute per-row group statistics to create a secondary index with a query like this

select 
  row_group_id,  <-- would like to get the row group id from the reader
  min(col), 
  max(col) 
from t
group by
 row_group_id

It is currently You can specify row groups one at a time with https://docs.rs/parquet/latest/parquet/arrow/arrow_reader/type.ParquetRecordBatchReaderBuilder.html#method.with_row_groups

Describe the solution you'd like
I would like a way to specify a "row group" column from the reader. If a file contained columns A and B, with this feature the reader would also produce a new column row_group_index:

A B row_group_index
10 v 0 (first row group)
20 d 0
40 a 0
... ... ...
90 z 1 (second row group)
50 f 1
... ... ...
10 b 2 (third row group)
60 a 2
... ... ...

Describe alternatives you've considered
The hardest part of this issue is figuring out what the API to request this extra column should look like

Additional context
Very similar to the request to add row numbers:

Activity

  1. added
    enhancement
    on Oct 17, 2025
  2. changed the title [-]Support returning RowGroupIndex as a column from parquet reader[/-] [+][Parquet] Support returning RowGroupIndex as a column[/+] on Nov 6, 2025
  3. adriangb commented on Nov 6, 2025

    @adriangb
    Contributor
  4. alamb commented on Nov 7, 2025

    @alamb
    ContributorAuthor

    I was thinking filename is probably more appropriate for DataFusion to add (similar to a partition column) -- as in the parquet-rs land there is only ever one file...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions