suxiaogang223 opened a new pull request, #1330:
URL: https://github.com/apache/paimon-rust/pull/1330
### Purpose
Linked issue: Closes #1327.
Related to #910 and #1257.
An embedding engine needs to export bounded ranges before passing commit
bodies to a size-limited
RPC. The existing API serializes every message before a caller can check the
resulting size.
Prepared with AI assistance.
### Brief change log
- Add `CommitMessage::serialize_with_limit(max_bytes)`, checking before each
output append while preserving the existing serializer and Java v14 bytes.
- Add `paimon_commit_messages_count(messages, count_output)` and
`paimon_commit_messages_serialize_range(messages, offset, count,
max_bytes)`.
- Reuse the existing byte-array result and free function. Validate range
overflow and bounds; return no partial output on failure and preserve the
source handle for a smaller-range retry.
### Tests
Validated with the existing Rust 1.97.0 toolchain on macOS arm64:
- `cargo +1.97.0 test --locked -p paimon-c --lib`: 95 passed, including the
existing
separate worker/coordinator process test.
- New coverage checks Java fixture equality, exact limits, one-byte-smaller
limits, cumulative limits, nonzero offsets, empty/invalid/overflowing
ranges,
null handles and output pointers, retry, output lifetime and Format Table
rejection.
- `cargo +1.97.0 test --locked -p paimon --lib
table::commit_message::tests`: 3 passed.
- `cargo +1.97.0 fmt --all -- --check` and `git diff --check`: passed.
- `cargo +1.97.0 clippy --locked -p paimon-c --all-targets -- -D warnings`:
passed.
Not run locally: CI-pinned Rust 1.98.0 checks, the full workspace/Vortex
suite, or the Linux/MSRV matrix. The results above cover the listed commands.
### API and Format
Additive Rust and C APIs. Existing full export and Java v14 body bytes remain
unchanged. No Java list wrapper, storage format or engine-specific framing is
added. The limit bounds the sum of body lengths, not peak allocations or RSS:
temporary metadata encoding, vector capacity and ownership conversion remain.
### Documentation
Add a range-export/retry example and explain byte limits and ownership in the
C integration guide.
--
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]