-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Deprecate ScalarUDFImpl::return_type #13717
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,6 +174,7 @@ impl ScalarUDF { | |
| /// | ||
| /// See [`ScalarUDFImpl::return_type`] for more details. | ||
| pub fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> { | ||
| #[allow(deprecated)] | ||
| self.inner.return_type(arg_types) | ||
| } | ||
|
|
||
|
|
@@ -450,6 +451,7 @@ pub trait ScalarUDFImpl: Debug + Send + Sync { | |
| /// is recommended to return [`DataFusionError::Internal`]. | ||
| /// | ||
| /// [`DataFusionError::Internal`]: datafusion_common::DataFusionError::Internal | ||
| #[deprecated(since = "44.0.0", note = "Use `return_type_from_exprs` instead")] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we are going to deprecate this API I think we should add an example to I can help if we proceed |
||
| fn return_type(&self, arg_types: &[DataType]) -> Result<DataType>; | ||
|
|
||
| /// What [`DataType`] will be returned by this function, given the | ||
|
|
@@ -483,6 +485,7 @@ pub trait ScalarUDFImpl: Debug + Send + Sync { | |
| _schema: &dyn ExprSchema, | ||
| arg_types: &[DataType], | ||
| ) -> Result<DataType> { | ||
| #[allow(deprecated)] | ||
| self.return_type(arg_types) | ||
| } | ||
|
|
||
|
|
@@ -756,6 +759,7 @@ impl ScalarUDFImpl for AliasedScalarUDFImpl { | |
| } | ||
|
|
||
| fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> { | ||
| #[allow(deprecated)] | ||
| self.inner.return_type(arg_types) | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,7 +148,9 @@ impl ScalarUDFImpl for DatePartFunc { | |
| } | ||
|
|
||
| fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> { | ||
| internal_err!("return_type_from_exprs shoud be called instead") | ||
| // return type could be Float32 or Int32 depending on the input arguments | ||
| // return_type_from_exprs should be called instead | ||
| Ok(DataType::Float64) | ||
|
||
| } | ||
|
|
||
| fn return_type_from_exprs( | ||
|
|
||
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.
Shouldn't we also deprecate this (
ScalarUDF::return_type) method if we deprecate underlyingScalarUDFImplmethod?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.
Yes