-
Notifications
You must be signed in to change notification settings - Fork 23
Introduce PartitionGetter and Partition utils #214
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
base: main
Are you sure you want to change the base?
Conversation
|
@luoyuxia @fresh-borzoni Appreciate your reviews here |
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 introduces partition-related utilities for the Fluss Rust client, mirroring functionality from the Java implementation. It adds partition validation, auto-partition generation, and partition value conversion capabilities.
Changes:
- Added
PartitionGetterfor extracting partition names/specs from rows - Added partition utilities including validation and auto-partition time generation
- Added validation functions to
TablePathfor name and prefix checking - Added new
InvalidPartitionerror variant
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/fluss/src/util/partition.rs | New file containing partition validation, auto-partition generation, and datum-to-string conversion utilities |
| crates/fluss/src/util/mod.rs | Exports the new partition module |
| crates/fluss/src/metadata/table.rs | Adds validation methods for table/partition names and prefixes |
| crates/fluss/src/error.rs | Adds InvalidPartition error variant for partition-related errors |
| crates/fluss/src/client/table/partition_getter.rs | Implements PartitionGetter to extract partition information from rows, with comprehensive test coverage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Copilot comments have been addressed |
fresh-borzoni
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.
@leekeiabstraction Thank you for the PR.
Left comments. PTAL
| } | ||
|
|
||
| fn format_date_time(total_nanos: i64, dt: DateTime) -> String { | ||
| if total_nanos > 0 { |
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.
What happens in Java and Rust when nanos are 0?
I see Java uses optional blocks, so wouldn't it return trailing _ if no nanos?
| let millis = ts.get_millisecond(); | ||
| let nano_of_milli = ts.get_nano_of_millisecond(); | ||
|
|
||
| let total_nanos = (millis % MILLIS_PER_SECOND) * NANOS_PER_MILLIS + (nano_of_milli as i64); |
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.
what would happen with negative timestamp?
| let millis = ts.get_epoch_millisecond(); | ||
| let nano_of_milli = ts.get_nano_of_millisecond(); | ||
|
|
||
| let total_nanos = (millis % MILLIS_PER_SECOND) * NANOS_PER_MILLIS + (nano_of_milli as i64); |
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.
ditto
Purpose
Linked issue: close #209
Brief change log
Tests