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

   # Rationale for this change
   
   `UpdateStatistics.remove_statistics()` assigned `self._updates = 
(RemoveStatisticsUpdate(snapshot_id=snapshot_id),)` instead of appending via 
`+=`. As a result, chaining `set_statistics(...).remove_statistics(...)`, using 
the context manager pattern shown in the `UpdateStatistics` and 
`Table.update_statistics()` docstrings, or calling `remove_statistics()` 
multiple times in one update silently discarded all previously queued updates.
   
   This change switches `self._updates = (...)` to `self._updates += (...)` in 
`UpdateStatistics.remove_statistics()`, preserving all pending statistics 
updates in the batch.
   
   ## Are these changes tested?
   
   Yes. Added end-to-end catalog tests in 
`tests/table/test_update_statistics.py` (no mocks, running across the `memory`, 
`sql`, and `sql_without_rowcount` catalog fixtures):
   
   - `test_update_statistics_set_and_remove_in_one_update` (chained, 
context-manager, and reverse order)
   - `test_update_statistics_multiple_removals_in_one_update`
   - `test_update_statistics_set_and_remove_in_transaction`
   
   Confirmed all 9 parametrized test cases fail prior to the fix (`9 failed`) 
and pass after the fix (`9 passed`), along with 
`tests/table/test_statistics.py` and `ruff` / `ty` / `codespell` checks.
   
   ## Are there any user-facing changes?
   
   Yes. Calling `remove_statistics()` after `set_statistics()` or another 
`remove_statistics()` in the same `UpdateStatistics` batch or context manager 
now preserves and commits all queued updates instead of silently dropping 
earlier ones.
   


-- 
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