Skip to content

Position delete read improvements#2532

Open
romusz wants to merge 3 commits into
apache:mainfrom
romusz:pos-delete-read-improvements
Open

Position delete read improvements#2532
romusz wants to merge 3 commits into
apache:mainfrom
romusz:pos-delete-read-improvements

Conversation

@romusz
Copy link
Copy Markdown

@romusz romusz commented May 30, 2026

Which issue does this PR close?

pre-work for #340, writer implementation to follow

What changes are included in this PR?

  • gate position deletes by referenced_data_file: closes TODO that applied every partition-scoped position delete to all data files in the partition.
  • resolve position-delete columns by field ID: by their reserved Iceberg field IDs instead of the assumed positional column order (file_path at index 0, pos at index 1).
  • distinguish scan metadata columns from delete-file fields: fixes corrupted projection when a user table with literally named columns pos or file_path which were resolved to a reserved metadata field ID instead of their real schema field IDs.

Are these changes tested?

  • unit tests
  • external integration tests: reading position delete files created with Spark

romusz added 3 commits May 29, 2026 22:07
Position delete files may set `referenced_data_file` to scope their deletes to a single data file. Per the Iceberg spec such a delete applies only when its `referenced_data_file` equals the data file's path exactly; a null value retains the prior partition-scoped behavior.

PopulatedDeleteFileIndex::get_deletes_for_data_file now enforces this, replacing the long-standing TODO that applied every partition-scoped position delete to all data files in the partition.
The caching delete-file loader assumed positional column order (file_path at index 0, pos at index 1) when parsing position delete files. Resolve the file_path and pos columns by their reserved Iceberg field IDs instead, via metadata_columns::resolve_position_delete_columns, so reordered or additional columns parse correctly.

Also reject non-Parquet delete files with a FeatureUnsupported error and reject negative positions as invalid data. FileScanTaskDeleteFile now carries the delete file's format and referenced_data_file from the manifest entry.

Includes test-fixture updates for the two new FileScanTaskDeleteFile fields.
Scan column resolution used is_metadata_column_name, which also matches the persisted delete-file schema fields file_path and pos. A user table column literally named pos or file_path was therefore resolved to a reserved metadata field ID instead of its real schema field ID, corrupting the projection.

Introduce is_scan_metadata_column_name, which matches only the virtual (underscore-prefixed) scan columns, and use it in scan planning. Deprecate rather than remove is_metadata_column_name, since it is published API as of 0.8.0.

Includes a scan test asserting a column named "pos" resolves to its table-schema field ID.
/// # Returns
/// `true` if the column name is a metadata column, `false` otherwise
#[deprecated(
since = "0.10.0",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this version needs to be agreed on

@romusz romusz changed the title Pos delete read improvements Position delete read improvements May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant