-
Notifications
You must be signed in to change notification settings - Fork 328
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
feat: type conversion between Values #2394
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #2394 +/- ##
===========================================
+ Coverage 77.63% 77.65% +0.01%
===========================================
Files 729 730 +1
Lines 115114 115885 +771
===========================================
+ Hits 89374 89985 +611
- Misses 25740 25900 +160 |
36a0f40
to
461b593
Compare
should allow other types unconditionally convert to |
Can you provide a function that detects whether one type can be cast to another? |
45dd867
to
18f1038
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.
Great work! Thank u.
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.
LGTM
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.
Mostly LGTM
Co-authored-by: dennis zhuang <[email protected]>
fd5f4e5
to
357c0fc
Compare
* feat: add cast() in datatype trait. * feat: add cast for primitive type * feat: add unit test cases * test: add datetime/time cases. * refactor: time_type cast function. * chore: typos. * refactor code. * feat: add can_cast_type func. * chore: rename cast to try_cast * feat: impl cast_with_opt * chore: pub use cast_with_opt * chore: add timezone for test * Update src/common/time/src/date.rs Co-authored-by: dennis zhuang <[email protected]> * chore: duration type --------- Co-authored-by: dennis zhuang <[email protected]>
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
main changes
try_cast()
indatatype
trait.date/time/timestamp/datetime
types.u8,u16,u32,u64,i8,i16,i32,i64,f32,f64
cast.cast_with_opt
method which supports two mode which can be set withCastOption
for casting type(for cast failed:strict mode
will return error andnon-strict
mode will return Null).Checklist
Refer to a related PR or issue link (optional)
Closes #2376