Skip to content

Conversation

@luoyuxia
Copy link
Contributor

Purpose

Linked issue: close #186

Brief change log

GenericRow::new() -> GenericRow::new(field_count: usize)

Tests

API and Format

Documentation

@luoyuxia
Copy link
Contributor Author

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

Updates GenericRow construction to require an explicit field count (pre-initialized to nulls) to better match Java behavior and allow partial rows (e.g., PK-only deletes).

Changes:

  • Change GenericRow::new() to GenericRow::new(field_count: usize) and update set_field to overwrite instead of insert.
  • Update call sites across core, bindings, examples, and integration tests to pass explicit field counts.
  • Modernize a number of error/diagnostic messages to use Rust’s named-format interpolation.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/fluss/src/row/mod.rs Introduces GenericRow::new(field_count) with null initialization; changes set_field semantics; updates tests.
crates/fluss/src/row/compacted/compacted_row_reader.rs Adjusts row creation to pre-sized rows for deserialization.
crates/fluss/tests/integration/kv_table.rs Updates integration tests to construct rows with explicit field counts; enables PK-only delete rows.
crates/fluss/tests/integration/table_remote_scan.rs Updates test row construction for append/scan scenario.
crates/fluss/src/record/arrow.rs Updates unit tests to construct rows with explicit field counts.
crates/fluss/src/client/table/log_fetch_buffer.rs Updates test row construction with explicit field counts.
crates/examples/src/example_table.rs Updates example to construct rows with explicit field counts.
crates/examples/src/example_kv_table.rs Updates KV example to use explicit field counts and demonstrate PK-only delete.
bindings/cpp/src/types.rs Updates FFI conversion to allocate rows with correct field count.
bindings/python/src/table.rs Refactors error strings (named interpolation) in Python binding conversions.
crates/fluss/src/row/datum.rs Refactors error strings (named interpolation).
crates/fluss/src/row/decimal.rs Refactors error strings (named interpolation).
crates/fluss/src/row/column.rs Refactors panic message formatting.
crates/fluss/src/metadata/table.rs Refactors error string formatting.
crates/fluss/src/metadata/partition.rs Refactors error string formatting.
crates/fluss/src/metadata/json_serde.rs Refactors JSON serde error string formatting.
crates/fluss/src/client/table/upsert.rs Refactors validation error string formatting.
crates/fluss/src/client/table/remote_log.rs Minor formatting / unused-variable tweak and message formatting updates.
Comments suppressed due to low confidence (1)

crates/fluss/src/row/compacted/compacted_row_reader.rs:59

  • GenericRow::new(self.row_type.fields().len()) already initializes every field to Datum::Null, so in the nullable/null branch you can skip row.set_field(col_pos, Datum::Null) and just continue;. This avoids an extra bounds-checked write per null field in a hot deserialization loop.
        let mut row = GenericRow::new(self.row_type.fields().len());
        let mut cursor = reader.initial_position();
        for (col_pos, data_field) in self.row_type.fields().iter().enumerate() {
            let dtype = &data_field.data_type;
            if dtype.is_nullable() && reader.is_null_at(col_pos) {
                row.set_field(col_pos, Datum::Null);
                continue;

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

@luoyuxia luoyuxia force-pushed the improve-generic-row branch from c1e6755 to ee6e40a Compare January 25, 2026 10:10
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.

LGTM, TY for the PR!

Copy link
Contributor

@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.

@luoyuxia Thanks for the PR
LGTM overall. One comment

we have:

impl<'a> Default for GenericRow<'a> 
 Self::new(0) 

Old code used insert, now we set:

  let mut row = GenericRow::default();                                                                                                                                                                                                               
  row.set_field(0, value);  // PANIC! index out of bounds

We should make it consistent or remove.

@luoyuxia
Copy link
Contributor Author

Thanks all for review

@luoyuxia luoyuxia merged commit 017bb15 into apache:main Jan 25, 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.

Improve GenericRow usage experience

3 participants