-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Minor: Move functionality into BuildInScalarFunction
#6612
Minor: Move functionality into BuildInScalarFunction
#6612
Conversation
f11a589
to
5bfd5ef
Compare
@@ -107,7 +105,7 @@ impl ExprSchemable for Expr { | |||
.iter() | |||
.map(|e| e.get_type(schema)) | |||
.collect::<Result<Vec<_>>>()?; | |||
function::return_type(fun, &data_types) | |||
fun.return_type(&data_types) |
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.
this is a pretty good example of the point of this PR -- the functionality is now part of fun
rather than a free function that takes &self
as its first argument
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 hope to apply the same pattern to window_function::return_type
and aggregate_function::return_type
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 hope to apply the same pattern to window_function::return_type and aggregate_function::return_type
🚀agree with it
@@ -1,125 +0,0 @@ | |||
// Licensed to the Apache Software Foundation (ASF) under one |
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.
This is recently added code from @2010YOUY01 (which was awesome) which I simply moved into BuiltInScalarFunction
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.
Make sense to me, thanks @alamb .
There are currently some conflicts. After the conflict is resolved, I think it can merge this PR to avoid conflict (the PR of the MOVE behavior
is easy to accumulate the conflict)
@@ -107,7 +105,7 @@ impl ExprSchemable for Expr { | |||
.iter() | |||
.map(|e| e.get_type(schema)) | |||
.collect::<Result<Vec<_>>>()?; | |||
function::return_type(fun, &data_types) | |||
fun.return_type(&data_types) |
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 hope to apply the same pattern to window_function::return_type and aggregate_function::return_type
🚀agree with it
I finally had a chance to whip this out: #6748 |
(Note this looks like a large change but it is actually quite small -- it is just moving code around)
Which issue does this PR close?
N/A
(though inspired by #5781 )
Rationale for this change
This has been a pet peeve of mine and I think it makes working with this code harder than needed as finding important functionality like "what is the signature of this function" harder because they aren't documented on https://docs.rs/datafusion-expr/26.0.0/datafusion_expr/enum.BuiltinScalarFunction.html
What changes are included in this PR?
signature
,return_type
andgenerate_signature_error_msg
to functions onBuiltinScalarFunction
Are these changes tested?
existing coverage
Are there any user-facing changes?
Hopefully easier to navigate code