suxiaogang223 opened a new pull request, #1507:
URL: https://github.com/apache/paimon-rust/pull/1507
### Purpose
Closes #1506.
Engines distributing rows before writing need the same partition and bucket
identity as the SDK. #1476 exposes bucket-only C routing. This change adds a
joint routing result and the input schema needed to construct routing
batches.
Prepared with AI assistance. Temporary memory scales with batch size and key
bytes. No performance measurements have been collected.
### Brief change log
- Add public Rust `BucketRouter::routing_schema()` and
`route_with_partitions()` for joint fixed-bucket routing.
- Add `paimon_bucket_router_export_arrow_schema` and
`paimon_bucket_router_route_with_partitions_arrow`, reusing the existing
schema-only handle, core partition encoding, bucket functions, Arrow
import,
result container and release functions.
- Return row-aligned non-null LargeBinary `partition_key` and Int32
`bucket_id`
columns. Require partition and bucket fields while accepting projected and
reordered inputs. Preserve empty and zero-column batch row counts.
- Document read-only concurrent calls, exclusive mutation/free, import
ownership
on success/error, and independently owned output/schema lifetimes.
### Tests
Local validation on macOS arm64 with the existing Rust 1.97.0 toolchain.
- C binding library suite passed 112 tests. New cases cover existing Java
goldens (NULL, integer boundaries, Unicode, Decimal, timestamps), MOD/HIVE
integer goldens, partition equality and Writer commit-metadata parity,
projected/reordered/missing/duplicate/wrong-type inputs, NOT NULL
validation,
empty/zero-column batches, concurrent reuse and Arrow ownership on errors.
- Core `table::bucket_router` passed 7 tests and `table::bucket_function`
passed 5 tests.
- `cargo +1.97.0 clippy --locked -p paimon -p paimon-c --lib --tests -- -D
warnings` passed.
- `cargo +1.97.0 fmt --all -- --check` and `git diff --check` passed.
- Generated the C header with cbindgen 0.29.4 and compiled a C11 ABI
signature
smoke test with `-Wall -Wextra -Werror`. Built the C library and ran a
linked
C program that creates a schema-only router, exports its schema, routes a
seven-row zero-column batch, checks input release callbacks, frees the
router
and consumes/releases the independently owned output. Both new symbols were
verified in the dylib export table.
The CI-pinned Rust 1.98.0, Linux/MSRV and workspace/Vortex matrix were not
run locally.
### API and Format
Two additive Rust methods and two additive C functions. Existing
construction,
bucket-only routing, plan replacement and free functions are reused. Joint C
routing initially targets fixed buckets. Plan-aware postpone joint routing
and
dynamic-bucket coordination are follow-up work.
Partition bytes are equality keys for one frozen schema and SDK
implementation
during execution. Persisted cross-version byte stability is unspecified.
Consumers control writer-channel assignment and must apply the same logical
preprocessing to routed and written values, including CHAR/default/timezone
and
precision handling. Temporary allocations use the normal Rust allocator.
### Documentation
Add schema-only joint routing usage, input/output and concurrency contracts,
batch-size memory considerations and the postpone follow-up boundary to the C
guide. Rustdoc specifies the public output schema and partition-key contract.
--
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]