-
Notifications
You must be signed in to change notification settings - Fork 21
[TASK-162] KVReadContext and read path wiring #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6bff46b to
8449dac
Compare
There was a problem hiding this 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 implements the ReadContext pattern and typed row decoding for the KV record read path, mirroring the Java reference implementation. It enables reading KV records with typed CompactedRow access while maintaining performance through decoder caching.
Changes:
- Added
ReadContexttrait andKvRecordReadContextimplementation with efficient double-check locking for decoder caching - Created
RowDecodertrait abstraction withCompactedRowDecoderimplementation for typed row decoding - Modified KV record API to support on-demand typed decoding via
KvRecord::row()method with decoder parameter - Consolidated tests from 19 to 12 while maintaining full coverage, all using the new typed API
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/fluss/src/row/row_decoder.rs | New row decoder trait and CompactedRowDecoder implementation with factory |
| crates/fluss/src/row/mod.rs | Exports new RowDecoder types |
| crates/fluss/src/record/kv/read_context.rs | ReadContext trait for providing schema-specific row decoders |
| crates/fluss/src/record/kv/kv_record_read_context.rs | Production ReadContext implementation with decoder caching |
| crates/fluss/src/record/kv/mod.rs | Module exports and TestReadContext utility for simplified testing |
| crates/fluss/src/record/kv/kv_record.rs | API changes: value_bytes field rename, new row() and is_deletion() methods |
| crates/fluss/src/record/kv/kv_record_batch.rs | API changes: records() now accepts ReadContext, returns KvRecords wrapper |
| crates/fluss/src/record/kv/kv_record_batch_builder.rs | Test consolidation and updates to use typed API |
💡 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fresh-borzoni Thanks for the pr. Left minor comments. PTAL
|
@luoyuxia Thanks for the review |
luoyuxia
left a comment
There was a problem hiding this 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
Purpose
Linked issue: close #162
Implement the ReadContext pattern and typed row decoding for the KV record read path, mirroring the Java reference implementation. This enables reading KV records with typed CompactedRow access while maintaining performance through decoder caching.
Core Infrastructure:
ReadContexttrait for providing schema-specific row decodersKvRecordReadContextwith double-check locking for decoder cachingRowDecodertrait abstraction withCompactedRowDecoderimplementationSchemaGettertrait for fallible schema retrievalAPI Changes:
KvRecordBatch::records()to accept&dyn ReadContextparameterKvRecordto support typed decoding viarow(&dyn RowDecoder)methodKvRecordIterator::row()helper method for ergonomic typed accessKvRecord(no Arc clone per record)Design Decisions:
Test Improvements:
API and Format
API Changes:
ReadContext,SchemaGetter,RowDecodertraitsKvRecordBatch::records()now requires&dyn ReadContextparameterKvRecord::row()returnsOption<CompactedRow<'_>>with decoder parameterKvRecordIterator::row()helper for ergonomic typed accessStorage Format:
Documentation
New Features: