Skip to content

MR: Pass partition constants to the format model read builder - #18037

Open
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/mr-format-model-id-to-constant
Open

MR: Pass partition constants to the format model read builder#18037
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/mr-format-model-id-to-constant

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Closes #18033

Summary

  • IcebergRecordReader.openTask() builds the reader without idToConstant(...), so identity partition values that live only in the manifest never reach the reader and come back as null.
  • This is a regression from a2802c4 (Data, MR: Moving other reader usages to the new FormatModel API #15333), which merged the Avro, ORC and Parquet branches into one ReadBuilder; all three used to pass constantsMap(task, IdentityPartitionConverters::convertConstant). data/GenericReader.openFile(), touched by the same PR, kept that call, and so do Flink's RowDataFileScanTaskReader and Spark's BaseRowReader.
  • Only data files that do not physically store the partition columns are affected. TableMigrationUtil.listPartition(...) takes partition values from Hive metadata rather than from the file, so tables imported with add_files/migrate hit this.

Testing done

  • Added TestIcebergInputFormats#identityPartitionValuesMissingFromDataFile, which writes a data file whose schema omits the identity partition columns and asserts the read-back values come from the manifest. It fails before the fix on all 6 parameterized variants (IcebergInputFormat/MapredIcebergInputFormat x Avro/ORC/Parquet) and passes after.
  • ./gradlew :iceberg-mr:check — 164 tests, 2 skipped, 0 failures.
  • :iceberg-mr is not a REVAPI module, so no API compatibility check applies.

AI Disclosure

  • Model: Claude Opus 5
  • Platform/Tool: Claude Code
  • Human Oversight: [unknown - human to fill in]
  • Prompt Summary: Restore the identity partition constants that IcebergInputFormat.IcebergRecordReader.openTask() stopped passing to the format model ReadBuilder in a2802c4, mirroring the sibling data/GenericReader.openFile(), and add a regression test in TestIcebergInputFormats.

IcebergRecordReader#openTask no longer passed the identity partition
constants to the reader after the Avro, ORC and Parquet branches were
merged into the single FormatModel ReadBuilder API in a2802c4
(apache#15333). Data files that do not physically store the identity
partition columns -- the ones produced by add_files/migrate through
TableMigrationUtil#listPartition -- are read back with null in those
columns instead of the value recorded in the manifest.

Build the constants map with PartitionUtil#constantsMap and pass it to
ReadBuilder#idToConstant, matching data/GenericReader#openFile, which
kept that call in the same change.

Generated-by: Claude Code
@github-actions github-actions Bot added the MR label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MR: IcebergInputFormat drops identity partition constants

1 participant