Skip to content

[TASK-250] KV Tables in CPP#288

Merged
luoyuxia merged 3 commits intoapache:mainfrom
fresh-borzoni:kv-tables-cpp
Feb 9, 2026
Merged

[TASK-250] KV Tables in CPP#288
luoyuxia merged 3 commits intoapache:mainfrom
fresh-borzoni:kv-tables-cpp

Conversation

@fresh-borzoni
Copy link
Contributor

@fresh-borzoni fresh-borzoni commented Feb 8, 2026

Summary

closes #250

KV Tables Support for C++ Bindings

Added UpsertWriter and Lookuper classes to the C++ bindings, enabling full KV table operations on primary-key tables.

UpsertWriter

  • Upsert and delete rows by primary key
  • Partial updates by column names (NewUpsertWriter(writer, {"user_id", "balance"}))
  • Partial updates by column indices (NewUpsertWriter(writer, {0, 1}))

Lookuper

  • Point lookups by primary key
  • Returns full row with all column values
  • Pads PK row to full schema width with Nulls (matching Python behavior)

Note: currently copies over FFI, will be optimized as part of broader #87

@fresh-borzoni
Copy link
Contributor Author

@luoyuxia @zhaohaidao PTAL 🙏

Copy link
Contributor

@leekeiabstraction leekeiabstraction left a comment

Choose a reason for hiding this comment

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

TY for the PR! Left some questions

@fresh-borzoni
Copy link
Contributor Author

@leekeiabstraction TY for the review.
Addressed comments, PTAL 🙏

Copy link

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

Adds KV-table (primary-key) operations to the C++ bindings by introducing upsert/delete and point-lookup APIs, plus required row/FFI conversions to match existing Rust/Python behavior.

Changes:

  • Add UpsertWriter and Lookuper to the C++ API and Rust/CXX bridge (create writer, upsert/delete/flush, lookup).
  • Add schema-aware GenericRow creation (Table::NewRow) and name-based setters for more ergonomic row building.
  • Improve/extend Rust↔FFI row conversions (including TinyInt/SmallInt and safer error propagation), and add a KV usage example + build targets.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
bindings/cpp/src/types.rs Improves datum conversions (TinyInt/SmallInt, timestamp error handling), returns Result instead of panicking, adds internal_row_to_ffi_row for lookup results.
bindings/cpp/src/table.cpp Implements C++ UpsertWriter/Lookuper, adds Table::NewRow() and schema column-map caching.
bindings/cpp/src/lib.rs Extends the CXX bridge with new KV types/APIs; adds Rust-side UpsertWriter/Lookuper implementations and lookup result wiring.
bindings/cpp/src/ffi_converter.hpp Minor formatting change.
bindings/cpp/include/fluss.hpp Adds schema-aware name-based setters on GenericRow, new KV API declarations.
bindings/cpp/examples/kv_example.cpp New end-to-end KV example covering upsert/delete/lookup and partial updates.
bindings/cpp/examples/admin_example.cpp Minor formatting change.
bindings/cpp/CMakeLists.txt Builds the new KV example binary.
bindings/cpp/BUILD.bazel Adds Bazel target for the KV example binary.

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

@fresh-borzoni
Copy link
Contributor Author

Addressed comments

Copy link
Contributor

@luoyuxia luoyuxia left a comment

Choose a reason for hiding this comment

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

@fresh-borzoni Thanks. LGTM!

@luoyuxia luoyuxia merged commit 61aa7e1 into apache:main Feb 9, 2026
13 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.

KV tables support in CPP

3 participants