Repository navigation
feat(c): expose joint partition and bucket routing - #1507
Merged
Merged
Conversation
JingsongLi
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
BucketRouter::routing_schema()androute_with_partitions()for joint fixed-bucket routing.paimon_bucket_router_export_arrow_schemaandpaimon_bucket_router_route_with_partitions_arrow, reusing the existingschema-only handle, core partition encoding, bucket functions, Arrow import,
result container and release functions.
partition_keyand Int32bucket_idcolumns. Require partition and bucket fields while accepting projected and
reordered inputs. Preserve empty and zero-column batch row counts.
on success/error, and independently owned output/schema lifetimes.
Tests
Local validation on macOS arm64 with the existing Rust 1.97.0 toolchain.
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.
table::bucket_routerpassed 7 tests andtable::bucket_functionpassed 5 tests.cargo +1.97.0 clippy --locked -p paimon -p paimon-c --lib --tests -- -D warningspassed.cargo +1.97.0 fmt --all -- --checkandgit diff --checkpassed.smoke test with
-Wall -Wextra -Werror. Built the C library and ran a linkedC 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.