hechao-ustc opened a new pull request, #612:
URL: https://github.com/apache/paimon-rust/pull/612

   <!--
   Thank you very much for contributing to Paimon Rust - we are happy that you 
want to help us improve it. To help the community review your contribution in 
the best possible way, please go through the checklist below, which will get 
the contribution into a shape in which it can be best reviewed.
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GitHub 
issue](https://github.com/apache/paimon-rust/issues). Exceptions are made for 
typos in documentation or comments, which need no issue.
   
     - Fill out the template below to describe the changes contributed by the 
pull request. That will give reviewers the context they need to do the review.
   
     - Make sure that the change passes the automated tests, i.e., `cargo test` 
passes.
   
     - Each pull request should address only one issue, not mix up code from 
multiple issues.
   
   **(The sections below can be removed for hotfixes or typos)**
   -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   The Python binding is missing write rollback support. The core Rust 
TableCommit has an `abort()` method and the C binding already exposes it via 
`paimon_table_commit_abort`, but Python users have no way to clean up data 
files after a failed write. This PR adds `abort()` to the Python binding so 
callers can delete newly written files (data, changelog, index) before a commit 
is persisted.
   
   <!-- What is the purpose of the change -->
   
   ### Brief change log
   
   <!-- Please describe the changes made in this pull request and explain how 
they address the issue -->
     - Extract message collection and validation into 
`collect_and_validate_messages` helper, shared by `commit()` and `abort()`
     - Add `PyTableCommit::abort()` — calls through to `TableCommit::abort()`, 
best-effort file deletion (storage errors silently ignored)
     - Add 5 unit tests covering the abort lifecycle and all validation paths
   
   ### Tests
   
   <!-- List unit tests or integration cases to verify this change -->
   New abort-specific tests in `bindings/python/tests/test_write.py`:
   
     | Test | Covers |                                                          
                                                         
     | ---- | ------ |
     | `test_abort_cleans_up_written_data` | Write → abort → table is empty |
     | `test_abort_empty_messages_noop` | Abort with no messages succeeds |
     | `test_abort_non_message_raises_typeerror` | Non-message input raises 
`TypeError` |
     | `test_abort_cross_table_messages_raises` | Messages from a different 
table rejected (`ValueError`) |
     | `test_abort_different_builder_same_table_raises` | Messages from a 
different `WriteBuilder` rejected (`ValueError`) |
   
   Run with:                                                                    
                                                       
     cd bindings/python
     .venv/bin/maturin develop --release
     .venv/bin/python -m pytest tests/test_write.py -v -k abort
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   New method on TableCommit:                                                   
                                                       
   
     table.new_write_builder().new_commit().abort(messages)
   
     - messages: a sequence of CommitMessage objects returned by 
prepare_commit()
     - Returns None on success
     - Raises TypeError if messages is not iterable or contains 
non-CommitMessage items
     - Raises ValueError if messages were prepared for a different table or by 
a different WriteBuilder
     - Deletion is best-effort — no error is raised for missing files or 
storage failures
     - Empty messages is a no-op
   
   ### Documentation
   
   


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

Reply via email to