Skip to main content

ensure_row_group_ordinals

Function ensure_row_group_ordinals 

Source
fn ensure_row_group_ordinals(row_groups: &mut [RowGroupMetaData]) -> Result<()>
Expand description

Ensure RowGroupMetaData::ordinal is usable after decode without rejecting spec-valid files (RowGroup.ordinal is optional in the parquet-format Thrift definition, with no uniformity requirement):

  • All row groups carry ordinals → honor them as written.
  • No row group carries an ordinal → assign each row group its position in the file. This happens unconditionally (not only when a consumer needs it) so downstream users of the ordinal — the row number virtual column, encryption chunk-key lookup — behave the same whether the metadata was decoded fresh or reused from a prior read.
  • Mixed → leave the metadata untouched. Positional backfill could disagree with the ordinals that are present, and a partial backfill would make row-number results depend on which row groups a query happens to select. Consumers that require complete ordinals fail deterministically instead (see RowNumberReader::try_new); plain reads that never touch ordinals succeed.