qzyu999 opened a new pull request, #3858:
URL: https://github.com/apache/iceberg-python/pull/3858

   Closes #3857
   
   # Rationale for this change
   
   `_DeleteFiles._compute_deletes` resets `self._deleted_data_files = set()` 
before scanning manifests by predicate. Files added via the inherited 
`delete_data_file()` method were silently dropped because the reset discards 
them before the manifest scan begins.
   
   This means calling `delete_data_file()` on a `_DeleteFiles` instance (via 
`update_snapshot().delete()`) produces no error and no effect.
   
   ## Root cause
   
   `_compute_deletes` rebuilds `_deleted_data_files` from predicate-matched 
entries only. Explicit file references added before the computation were lost.
   
   ## Fix
   
   Preserve the explicit set before resetting, and include those files in the 
`should_delete` check alongside predicate evaluation. This is a 6-line 
production change.
   
   ## Are these changes tested?
   
   Two new tests covering:
   1. Explicit `delete_data_file()` on a `_DeleteFiles` instance deletes the 
file
   2. Explicit file deletion works when the table has multiple data files (only 
the targeted file is removed)
   
   Both pass across all 3 catalog backends (memory, sql, sql_without_rowcount). 
Existing snapshot and commit-retry tests (169 total) continue to pass.
   
   ## Are there any user-facing changes?
   
   `delete_data_file()` on a `_DeleteFiles` instance now correctly deletes the 
specified file instead of silently doing nothing.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to