|
20 | 20 | use crate::expr::schema_name_from_exprs_comma_seperated_without_space;
|
21 | 21 | use crate::simplify::{ExprSimplifyResult, SimplifyInfo};
|
22 | 22 | use crate::sort_properties::{ExprProperties, SortProperties};
|
23 |
| -use crate::{ |
24 |
| - ColumnarValue, Expr, ReturnTypeFunction, ScalarFunctionImplementation, Signature, |
25 |
| -}; |
| 23 | +use crate::{ColumnarValue, Expr, ScalarFunctionImplementation, Signature}; |
26 | 24 | use arrow::datatypes::DataType;
|
27 | 25 | use datafusion_common::{not_impl_err, ExprSchema, Result};
|
28 | 26 | use datafusion_expr_common::interval_arithmetic::Interval;
|
29 | 27 | use std::any::Any;
|
30 |
| -use std::fmt::{self, Debug, Formatter}; |
| 28 | +use std::fmt::Debug; |
31 | 29 | use std::hash::{DefaultHasher, Hash, Hasher};
|
32 | 30 | use std::sync::Arc;
|
33 | 31 |
|
@@ -73,25 +71,6 @@ impl Hash for ScalarUDF {
|
73 | 71 | }
|
74 | 72 |
|
75 | 73 | impl ScalarUDF {
|
76 |
| - /// Create a new ScalarUDF from low level details. |
77 |
| - /// |
78 |
| - /// See [`ScalarUDFImpl`] for a more convenient way to create a |
79 |
| - /// `ScalarUDF` using trait objects |
80 |
| - #[deprecated(since = "34.0.0", note = "please implement ScalarUDFImpl instead")] |
81 |
| - pub fn new( |
82 |
| - name: &str, |
83 |
| - signature: &Signature, |
84 |
| - return_type: &ReturnTypeFunction, |
85 |
| - fun: &ScalarFunctionImplementation, |
86 |
| - ) -> Self { |
87 |
| - Self::new_from_impl(ScalarUdfLegacyWrapper { |
88 |
| - name: name.to_owned(), |
89 |
| - signature: signature.clone(), |
90 |
| - return_type: Arc::clone(return_type), |
91 |
| - fun: Arc::clone(fun), |
92 |
| - }) |
93 |
| - } |
94 |
| - |
95 | 74 | /// Create a new `ScalarUDF` from a `[ScalarUDFImpl]` trait object
|
96 | 75 | ///
|
97 | 76 | /// Note this is the same as using the `From` impl (`ScalarUDF::from`)
|
@@ -719,61 +698,3 @@ impl ScalarUDFImpl for AliasedScalarUDFImpl {
|
719 | 698 | hasher.finish()
|
720 | 699 | }
|
721 | 700 | }
|
722 |
| - |
723 |
| -/// Implementation of [`ScalarUDFImpl`] that wraps the function style pointers |
724 |
| -/// of the older API (see <https://github.com/apache/datafusion/pull/8578> |
725 |
| -/// for more details) |
726 |
| -struct ScalarUdfLegacyWrapper { |
727 |
| - /// The name of the function |
728 |
| - name: String, |
729 |
| - /// The signature (the types of arguments that are supported) |
730 |
| - signature: Signature, |
731 |
| - /// Function that returns the return type given the argument types |
732 |
| - return_type: ReturnTypeFunction, |
733 |
| - /// actual implementation |
734 |
| - /// |
735 |
| - /// The fn param is the wrapped function but be aware that the function will |
736 |
| - /// be passed with the slice / vec of columnar values (either scalar or array) |
737 |
| - /// with the exception of zero param function, where a singular element vec |
738 |
| - /// will be passed. In that case the single element is a null array to indicate |
739 |
| - /// the batch's row count (so that the generative zero-argument function can know |
740 |
| - /// the result array size). |
741 |
| - fun: ScalarFunctionImplementation, |
742 |
| -} |
743 |
| - |
744 |
| -impl Debug for ScalarUdfLegacyWrapper { |
745 |
| - fn fmt(&self, f: &mut Formatter) -> fmt::Result { |
746 |
| - f.debug_struct("ScalarUDF") |
747 |
| - .field("name", &self.name) |
748 |
| - .field("signature", &self.signature) |
749 |
| - .field("fun", &"<FUNC>") |
750 |
| - .finish() |
751 |
| - } |
752 |
| -} |
753 |
| - |
754 |
| -impl ScalarUDFImpl for ScalarUdfLegacyWrapper { |
755 |
| - fn as_any(&self) -> &dyn Any { |
756 |
| - self |
757 |
| - } |
758 |
| - fn name(&self) -> &str { |
759 |
| - &self.name |
760 |
| - } |
761 |
| - |
762 |
| - fn signature(&self) -> &Signature { |
763 |
| - &self.signature |
764 |
| - } |
765 |
| - |
766 |
| - fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> { |
767 |
| - // Old API returns an Arc of the datatype for some reason |
768 |
| - let res = (self.return_type)(arg_types)?; |
769 |
| - Ok(res.as_ref().clone()) |
770 |
| - } |
771 |
| - |
772 |
| - fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> { |
773 |
| - (self.fun)(args) |
774 |
| - } |
775 |
| - |
776 |
| - fn aliases(&self) -> &[String] { |
777 |
| - &[] |
778 |
| - } |
779 |
| -} |
0 commit comments