-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
chore: remove deprecated variants of UDF's invoke (invoke, invoke_no_args, invoke_batch) #15123
chore: remove deprecated variants of UDF's invoke (invoke, invoke_no_args, invoke_batch) #15123
Conversation
…args, invoke_batch) Leaving only invoke_with_args
@@ -89,6 +92,10 @@ impl ScalarUDFImpl for DummyUDF { | |||
fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> { | |||
Ok(DataType::Int32) | |||
} | |||
|
|||
fn invoke_with_args(&self, _args: ScalarFunctionArgs) -> Result<ColumnarValue> { | |||
panic!("dummy - not implemented") |
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 about using not_impl_err
instead of painc
?
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 copied https://github.com/apache/datafusion/pull/15123/files#diff-351499880963d6a383c92e156e75019cd9ce33107724a9635853d7d4cd1898d0R1602 - but happy to change, would you prefer not_impl_err
?
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 checked other traits, it would prefer unimplemented!()
.
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.
FWIW this is a test
#[deprecated(since = "42.1.0", note = "Use `invoke_with_args` instead")] | ||
pub fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> { | ||
#[allow(deprecated)] | ||
self.inner.invoke(args) | ||
} | ||
|
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 comment was marked as resolved.
This comment was marked as resolved.
In general this is true -- however, in this case since several of the example APIs can't actually be used (see this section of the upgrade guide) I think it is worth considering just removing the APIs and forcing downstream crates to update |
Yeah, from my perspective this one isn't so bad - implementing any of the deprecated methods is kinda okay, since the defaults are wired to propagate the call correctly here. Calling them is not fine, but as they're marked as deprecated that should be enough to prevent the calls. The other removal (return_type_from_exprs) is more important since there the call chain doesn't work. But then if we do one removal, it might make sense to just do the other one too, to end up with a clean interface.. Up to you guys, I'm happy to have this merged or turn it back into draft and merge later :) |
I agree I made a note on the release ticket that we should write a note in the upgrade guide |
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.
Thank you @Blizzara -- I think we should make this change even though it isn't following the normal deprecation cycle
I think an API that compiles but errors at runtime is even worse than having to fix a compiler error.
I merged this PR up from main and plan to leave it open for a day or two more. Then I'll merge it in. |
🔨 let's go |
Thanks again @Weijun-H @jayzhan211 and @Blizzara |
Leaving only invoke_with_args
Which issue does this PR close?
Followup form #15049
ScalarUDF::invoke_batch
#14652Rationale for this change
The UDF trait has 4 different ways of implementing
invoke
, with 3 of them deprecated. This cleans the trait up.What changes are included in this PR?
invoke
,invoke_no_args
, andinvoke_batch
are removedinvoke_with_args
has its default implementation removed, forcing users to implement itinvoke
max
UDF is fixed to implementinvoke_with_args
insteadinvoke_with_args
insteadAre these changes tested?
Existing tests
Are there any user-facing changes?
yes, BREAKING CHANGE: remove deprecated variants of UDF's invoke (invoke, invoke_no_args, invoke_batch)