Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hi @Fokko @kevinjqliu, could one of you take a look when you have time? Thanks! |
tusharchou
left a comment
There was a problem hiding this comment.
Thanks for this. I checked it locally and it looks right to me.
What I ran
The 2 new tests pass on this branch, 6 cases across the 3 catalogs. With the one line reverted they fail. The update_spec test deletes (2, 1) and keeps (3, 2), and the add_column test raises IndexError.
I merged the branch onto main at fef852f, which now includes #4338. tests/table/test_init.py gives 184 passed. The 4 failures are the same 4 that fail on plain main in my env, because pyiceberg-core and polars are not installed.
A few extra cases inside one transaction. Each of these was wrong or raised on main and is correct with this change.
Rename the partition source column, then overwrite.
update_spec, then 2 overwrites of the same partition. Main kept all 3 rows with b = 2.
The new data file is recorded under the staged spec id.
A v1 table with add_identity.
A write property set earlier in the transaction (the compression codec) is now honoured, the same as append and overwrite.
Small things
The description says the add_column case raises ValueError. On main I get IndexError (list index out of range).
Not from this PR, but in the same function. On a v1 table, removing a partition field leaves a void transform, and the identity only check rejects it, so dynamic overwrite fails after any field removal. Happy to open an issue for that.
#4204 changes the line that builds partitions_fields, so one of the two will need a rebase.
LGTM
Closes #4192
Rationale for this change
Transaction.dynamic_partition_overwritewrote its data files using thecommitted table metadata, but built its delete filter from the transaction's
metadata. After an
update_specin the same transaction, the two disagree onthe partition spec, so the wrong rows can be deleted and new files recorded
under the wrong partition. After an in-transaction
add_column, it raisesValueErrorinstead.This passes
self.table_metadatato_dataframe_to_data_files, matchingappend,overwriteanddelete.Are these changes tested?
Yes. Two new tests cover
update_specandadd_columninside 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.