Fix panic / crashes in Rust and C++#365
Conversation
|
@fresh-borzoni Appreciate your review here 🙏 |
charlesdong1991
left a comment
There was a problem hiding this comment.
Nice PR!
i just started using fluss, and learn about the repo, I put a couple comments also to help myself to understand the repo better! ^^
thanks!
fresh-borzoni
left a comment
There was a problem hiding this comment.
@leekeiabstraction Ty, left some comments.
PTAL
|
Thank you for the reviews and discussions. Pushed new rev PTAL @fresh-borzoni @luoyuxia |
|
Missed some IT test changes, will push in my evening |
|
Also appreciate if you can review again @charlesdong1991 |
charlesdong1991
left a comment
There was a problem hiding this comment.
A minor comment but i think if we wanna address, better to do in a follow up PR
There was a problem hiding this comment.
@leekeiabstraction Ty, LGTM. Left some comments.
we may wish to just reorder schema.field with column fetch line to resolve this or some helper with bounds checks
|
@fresh-borzoni Nice catch, addressed! |
fresh-borzoni
left a comment
There was a problem hiding this comment.
@leekeiabstraction Ty, LGTM
|
Thanks @leekeiabstraction I'll have a final review tomorrow. |
There was a problem hiding this comment.
Pull request overview
This pull request fixes critical panics and crashes in Rust and C++ bindings by adding proper error handling for row getter operations. The changes address two main issues: (1) calling typed getters (e.g., get_int) on columns with wrong types or out-of-bounds indices, and (2) appending rows with mismatched column counts or types to log tables.
Changes:
- Modified
InternalRowtrait methods to returnResult<T>instead ofT, enabling error propagation instead of panics - Added field count validation in
AppendWriterandUpsertWriterto catch schema mismatches early - Updated all implementations of
InternalRow(GenericRow, CompactedRow, ColumnarRow) to return proper errors - Propagated error handling through all layers including field getters, encoders, and bindings
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/fluss/src/row/mod.rs | Core trait change: InternalRow methods now return Result for error handling |
| crates/fluss/src/row/column.rs | ColumnarRow implementation updated with bounds and type checking |
| crates/fluss/src/row/compacted/compacted_row.rs | CompactedRow implementation updated with error handling |
| crates/fluss/src/row/field_getter.rs | Field getter propagates errors from row accessors |
| crates/fluss/src/client/table/append.rs | Added field count validation before appending rows |
| crates/fluss/src/client/table/upsert.rs | Added field count validation before upserting rows |
| crates/fluss/tests/integration/log_table.rs | Test updates with .unwrap() calls and new undersized_row test |
| crates/fluss/tests/integration/kv_table.rs | Test updates with .unwrap() calls for error handling |
| bindings/python/src/table.rs | Python binding updated to propagate errors |
| bindings/cpp/src/lib.rs | C++ binding updated to convert errors to strings |
| examples/* | Example code updated with proper error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
luoyuxia
left a comment
There was a problem hiding this comment.
@leekeiabstraction Thanks for the pr. The code looks good to me. But please don't forget to update the documentation, which can be done in another pr.
Purpose
Linked issue: close #361, #362
Fix panic / crashes in Rust and C++ when
Brief change log
Tests
Updated tests.