-
Notifications
You must be signed in to change notification settings - Fork 314
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: support different types for CompatReader
#3745
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3745 +/- ##
==========================================
- Coverage 85.51% 85.28% -0.24%
==========================================
Files 946 946
Lines 159555 160034 +479
==========================================
+ Hits 136447 136482 +35
- Misses 23108 23552 +444 |
|
Maybe we could only allow modifying the data type when the column is nullable or casting the type won't be fallible. |
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.
Sorry for the slow review. Don't have enough time to review this last week.
- add unit test `test_safe_cast_to_null` to test safely cast - add DataType to projected_fields - remove TODO
I added this check in pr: #3757 9003afc
I think this is difficult to do. Because when conversion is allowed between certain types, the value may not necessarily be able to be converted. Of course, conversion between some types is definitely successful(to String), but judging by self will be relatively intrusive (and prone to bugs) so I chose to check if column is allowed to be nullable |
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
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.
LGTM. Thanks!
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!
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
#3517
What's changed and what's your intention?
Support CompatReader to be compatible with different types of reads (for modify column type)
Whether the type allows conversion will be verified in the next pr: (reference:
ModifyColumn::validate
https://github.com/GreptimeTeam/greptimedb/pull/3701/files#diff-839e23ed322c90eacc42fdddeb1f7108335e6434eba0a7a1c6dbc42052a8b9e9)Tips: Please closely 64FD8R166 in the
cast
in this line of code, thesafe
of theCastOptions
it used by default is true, so it is guaranteed that the type is allowed to be transformed and specific When the value cannot be converted, set the value to null, e.g. type:String
->Integer
, value:"1"
->1
,"hello"
->null
Checklist