Skip to content

Use transaction metadata in dynamic_partition_overwrite - #4221

Open
bethvourc wants to merge 1 commit into
apache:mainfrom
bethvourc:fix/dynamic-overwrite-transaction-metadata
Open

bethvourc wants to merge 1 commit into
apache:mainfrom
bethvourc:fix/dynamic-overwrite-transaction-metadata

Conversation

@bethvourc

Copy link
Copy Markdown

Closes #4192

Rationale for this change

Transaction.dynamic_partition_overwrite wrote its data files using the
committed table metadata, but built its delete filter from the transaction's
metadata. After an update_spec in the same transaction, the two disagree on
the partition spec, so the wrong rows can be deleted and new files recorded
under the wrong partition. After an in-transaction add_column, it raises
ValueError instead.

This passes self.table_metadata to _dataframe_to_data_files, matching
append, overwrite and delete.

Are these changes tested?

Yes. Two new tests cover update_spec and add_column inside a transaction.
Both fail without the fix and pass with it. The full unit suite, the Docker
integration suite and the lint hooks pass locally.

Are there any user-facing changes?

Yes, only as the bug fix: both cases now behave correctly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

dynamic_partition_overwrite after an in-transaction update_spec loses rows

1 participant