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
Other functions migrate to Function2 trait #4036
Other functions migrate to Function2 trait #4036
Conversation
Thanks for the contribution! Please review the labels and make any necessary changes. |
1 similar comment
Thanks for the contribution! Please review the labels and make any necessary changes. |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/databend/databend/253HGRXVucQphNZMBWXGfKWq6tYh [Deployment for 21965c4 canceled] |
89b59a6
to
60744da
Compare
Codecov Report
@@ Coverage Diff @@
## datavalues-dev #4036 +/- ##
===============================================
Coverage 56% 56%
===============================================
Files 841 841
Lines 45049 45155 +106
===============================================
+ Hits 25605 25677 +72
- Misses 19444 19478 +34
Continue to review full report at Codecov.
|
SELECT '=== INET_ATON ==='; | ||
SELECT INET_ATON('10.0.5.9'); | ||
SELECT INET_ATON(NULL); | ||
SELECT INET_ATON('hello'); |
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.
Should we throw the exceptions if parsing failed?
We can have TRY_INET_ATON
later to enable the catch of the error to be null.
4697288
to
a3d8a0f
Compare
@@ -120,7 +133,12 @@ impl Function2 for Function2Adapter { | |||
} | |||
}; | |||
|
|||
let col = NullableColumn::new(col, validity); | |||
let col = if col.is_nullable() { | |||
let nullable_column: &NullableColumn = col.as_any().downcast_ref().unwrap(); |
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.
Series::static_cast
Ok(DataColumn::Constant(DataValue::UInt8(Some(0)), input_rows)) | ||
fn eval(&self, _columns: &ColumnsWithField, input_rows: usize) -> Result<ColumnRef> { | ||
let return_type = type_primitive::UInt8Type::arc(); | ||
let return_value = DataValue::try_from(0_u8)?; |
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.
I just thought that we can return Boolean Column instead of U8 Column.
// For invalid input, the function returns null, so the nullable is true. | ||
Ok(DataTypeAndNullable::create(&data_type, true)) | ||
|
||
if SUPPRESS_PARSE_ERROR { |
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!
return Ok(builder.build(input_rows)); | ||
} | ||
|
||
if columns[0].column().data_type_id() == TypeID::Null { |
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.
It looks we already did it in the adaptor.
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.
I have passthrough_null is false for this case ...... 😢
a3d8a0f
to
21965c4
Compare
LGTM |
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
Migrate other functions to Function2
Changelog
Related Issues
Fixes #3974
Test Plan
Unit Tests
Stateless Tests