Skip to content

[rust] support paimon key encoder.#579

Merged
fresh-borzoni merged 1 commit into
apache:mainfrom
loserwang1024:key-encoder
Jun 2, 2026
Merged

[rust] support paimon key encoder.#579
fresh-borzoni merged 1 commit into
apache:mainfrom
loserwang1024:key-encoder

Conversation

@loserwang1024
Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #314

Brief change log

Tests

API and Format

Documentation

@loserwang1024 loserwang1024 force-pushed the key-encoder branch 2 times, most recently from 55a190f to c9f2df8 Compare June 1, 2026 12:24
@luoyuxia luoyuxia requested a review from Copilot June 1, 2026 12:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Paimon (BinaryRow-based) key encoding support to the Rust client and wires it into KV upsert/lookup/prefix-lookup paths, enabling the client to interoperate with Paimon-backed KV tables and newer key-encoding expectations.

Changes:

  • Implement Paimon BinaryRow writer + Paimon key encoder and integrate into KeyEncoderFactory.
  • Update KV upsert/lookup/prefix-lookup to select primary/bucket key encoders based on kv_format_version and bucket-key layout.
  • Extend supported RPC API versions for PutKv/Lookup/PrefixLookup and adjust integration tests to exercise Paimon encoding.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/fluss/tests/integration/kv_table.rs Updates/extends KV integration tests to cover Paimon key encoding and prefix lookup.
crates/fluss/src/rpc/api_key.rs Advertises v1 support for PutKv/Lookup/PrefixLookup API keys.
crates/fluss/src/row/paimon/paimon_binary_row_writer.rs New Paimon BinaryRow writer implementation with unit tests.
crates/fluss/src/row/paimon/mod.rs New module wiring for Paimon row utilities.
crates/fluss/src/row/mod.rs Exposes the new row::paimon module.
crates/fluss/src/row/encode/paimon_key_encoder.rs New Paimon key encoder implementation with unit tests.
crates/fluss/src/row/encode/mod.rs Integrates PaimonKeyEncoder; adds primary/bucket key encoder selection helpers.
crates/fluss/src/metadata/table.rs Adds TableConfig::get_kv_format_version() with defaulting behavior.
crates/fluss/src/client/table/upsert.rs Uses kv_format_version + bucket-key layout to choose key encoders for writes.
crates/fluss/src/client/table/lookup.rs Uses kv_format_version + bucket-key layout to choose key encoders for lookups and prefix lookups.
.run/Test.run.xml Adds an IDE run configuration for integration tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/fluss/src/row/paimon/paimon_binary_row_writer.rs
Comment thread crates/fluss/tests/integration/kv_table.rs
Comment thread crates/fluss/src/rpc/api_key.rs
Comment thread .run/Test.run.xml Outdated
Comment thread crates/fluss/tests/integration/kv_table.rs Outdated
@loserwang1024 loserwang1024 force-pushed the key-encoder branch 2 times, most recently from e76e2fd to 4afae5e Compare June 2, 2026 03:07
Copy link
Copy Markdown
Member

@fresh-borzoni fresh-borzoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loserwang1024 Ty for the PR, LGTM 👍

if Decimal::is_compact_precision(precision) {
// Compact: store unscaled long in the field slot (use write_long
// semantics but consume `current_pos` exactly once).
let unscaled = value.to_unscaled_long().unwrap_or(0);
Copy link
Copy Markdown
Member

@fresh-borzoni fresh-borzoni Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unwrap_or(0) silently writes 0 if the conversion ever fails.
In practice it can't for a valid compact decimal, so it's basically dead code, still it's usually better to fail loudly

@fresh-borzoni fresh-borzoni merged commit 9f3e877 into apache:main Jun 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce Paimon key encoder

3 participants