diff --git a/common/functions/src/scalars/arithmetics/arithmetic_modulo.rs b/common/functions/src/scalars/arithmetics/arithmetic_modulo.rs index 486528056fe4..999031124352 100644 --- a/common/functions/src/scalars/arithmetics/arithmetic_modulo.rs +++ b/common/functions/src/scalars/arithmetics/arithmetic_modulo.rs @@ -73,8 +73,8 @@ where "ModuloFunctionImpl" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(O::to_data_type()) + fn return_type(&self) -> DataTypePtr { + O::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/arithmetics/binary_arithmetic.rs b/common/functions/src/scalars/arithmetics/binary_arithmetic.rs index aa9fa5c76fbf..bd5874cddb77 100644 --- a/common/functions/src/scalars/arithmetics/binary_arithmetic.rs +++ b/common/functions/src/scalars/arithmetics/binary_arithmetic.rs @@ -70,8 +70,8 @@ where "BinaryArithmeticFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/arithmetics/unary_arithmetic.rs b/common/functions/src/scalars/arithmetics/unary_arithmetic.rs index dc1a7f262220..ec92ad42b542 100644 --- a/common/functions/src/scalars/arithmetics/unary_arithmetic.rs +++ b/common/functions/src/scalars/arithmetics/unary_arithmetic.rs @@ -65,8 +65,8 @@ where "UnaryArithmeticFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/comparisons/comparison.rs b/common/functions/src/scalars/comparisons/comparison.rs index 49aa4eea91d3..6cdd57dcaa1d 100644 --- a/common/functions/src/scalars/comparisons/comparison.rs +++ b/common/functions/src/scalars/comparisons/comparison.rs @@ -87,8 +87,8 @@ impl Function for ComparisonFunction { self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(BooleanType::arc()) + fn return_type(&self) -> DataTypePtr { + BooleanType::arc() } fn eval( diff --git a/common/functions/src/scalars/conditionals/if.rs b/common/functions/src/scalars/conditionals/if.rs index b1d13be683d8..934a627f8eea 100644 --- a/common/functions/src/scalars/conditionals/if.rs +++ b/common/functions/src/scalars/conditionals/if.rs @@ -250,8 +250,8 @@ impl Function for IfFunction { "IfFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.least_supertype.clone()) + fn return_type(&self) -> DataTypePtr { + self.least_supertype.clone() } fn eval( diff --git a/common/functions/src/scalars/conditionals/in_basic.rs b/common/functions/src/scalars/conditionals/in_basic.rs index 3f31675602af..7811f11b5058 100644 --- a/common/functions/src/scalars/conditionals/in_basic.rs +++ b/common/functions/src/scalars/conditionals/in_basic.rs @@ -111,11 +111,11 @@ impl Function for InFunction { "InFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { + fn return_type(&self) -> DataTypePtr { if self.is_null { - return Ok(NullType::arc()); + return NullType::arc(); } - Ok(BooleanType::arc()) + BooleanType::arc() } fn eval( diff --git a/common/functions/src/scalars/conditionals/is_not_null.rs b/common/functions/src/scalars/conditionals/is_not_null.rs index a52db20e3749..7fad11ea19af 100644 --- a/common/functions/src/scalars/conditionals/is_not_null.rs +++ b/common/functions/src/scalars/conditionals/is_not_null.rs @@ -54,8 +54,8 @@ impl Function for IsNotNullFunction { "IsNotNullFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(bool::to_data_type()) + fn return_type(&self) -> DataTypePtr { + bool::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/conditionals/is_null.rs b/common/functions/src/scalars/conditionals/is_null.rs index 9204f3d9e589..cf64462f3834 100644 --- a/common/functions/src/scalars/conditionals/is_null.rs +++ b/common/functions/src/scalars/conditionals/is_null.rs @@ -54,8 +54,8 @@ impl Function for IsNullFunction { "IsNullFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(bool::to_data_type()) + fn return_type(&self) -> DataTypePtr { + bool::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/contexts/current_user.rs b/common/functions/src/scalars/contexts/current_user.rs index f0b913ebc7c3..f290f6fb6e89 100644 --- a/common/functions/src/scalars/contexts/current_user.rs +++ b/common/functions/src/scalars/contexts/current_user.rs @@ -14,6 +14,7 @@ use std::fmt; +use common_datavalues::DataTypePtr; use common_datavalues::StringType; use common_exception::Result; @@ -47,11 +48,8 @@ impl Function for CurrentUserFunction { "CurrentUserFunction" } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/contexts/database.rs b/common/functions/src/scalars/contexts/database.rs index 6618d537c2d9..aad5824bd1b9 100644 --- a/common/functions/src/scalars/contexts/database.rs +++ b/common/functions/src/scalars/contexts/database.rs @@ -14,6 +14,7 @@ use std::fmt; +use common_datavalues::DataTypePtr; use common_datavalues::StringType; use common_exception::Result; @@ -48,11 +49,8 @@ impl Function for DatabaseFunction { "DatabaseFunction" } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/contexts/version.rs b/common/functions/src/scalars/contexts/version.rs index 7e3732ba3f35..2b20be1c07e7 100644 --- a/common/functions/src/scalars/contexts/version.rs +++ b/common/functions/src/scalars/contexts/version.rs @@ -14,6 +14,7 @@ use std::fmt; +use common_datavalues::DataTypePtr; use common_datavalues::StringType; use common_exception::Result; @@ -51,11 +52,8 @@ impl Function for VersionFunction { "VersionFunction" } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/dates/interval_function.rs b/common/functions/src/scalars/dates/interval_function.rs index d47e639b0eab..2c6542584e00 100644 --- a/common/functions/src/scalars/dates/interval_function.rs +++ b/common/functions/src/scalars/dates/interval_function.rs @@ -150,8 +150,8 @@ where self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/dates/now.rs b/common/functions/src/scalars/dates/now.rs index 775c52616fac..489c2993fa1c 100644 --- a/common/functions/src/scalars/dates/now.rs +++ b/common/functions/src/scalars/dates/now.rs @@ -48,8 +48,8 @@ impl Function for NowFunction { self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(DateTime32Type::arc(None)) + fn return_type(&self) -> DataTypePtr { + DateTime32Type::arc(None) } fn eval( diff --git a/common/functions/src/scalars/dates/number_function.rs b/common/functions/src/scalars/dates/number_function.rs index f73ad111fe71..765dd725ad8b 100644 --- a/common/functions/src/scalars/dates/number_function.rs +++ b/common/functions/src/scalars/dates/number_function.rs @@ -351,10 +351,10 @@ where self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { + fn return_type(&self) -> DataTypePtr { match T::return_type() { - None => Ok(R::to_data_type()), - Some(v) => Ok(v), + None => R::to_data_type(), + Some(v) => v, } } diff --git a/common/functions/src/scalars/dates/round_function.rs b/common/functions/src/scalars/dates/round_function.rs index 388ee7b3dfe2..a91e63b44e9b 100644 --- a/common/functions/src/scalars/dates/round_function.rs +++ b/common/functions/src/scalars/dates/round_function.rs @@ -66,8 +66,8 @@ impl Function for RoundFunction { self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(DateTime32Type::arc(None)) + fn return_type(&self) -> DataTypePtr { + DateTime32Type::arc(None) } fn eval( diff --git a/common/functions/src/scalars/dates/simple_date.rs b/common/functions/src/scalars/dates/simple_date.rs index 4a82f3c80308..1bb94ae129ba 100644 --- a/common/functions/src/scalars/dates/simple_date.rs +++ b/common/functions/src/scalars/dates/simple_date.rs @@ -100,8 +100,8 @@ where T: NoArgDateFunction + Clone + Sync + Send + 'static self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Date16Type::arc()) + fn return_type(&self) -> DataTypePtr { + Date16Type::arc() } fn eval( diff --git a/common/functions/src/scalars/dates/week_date.rs b/common/functions/src/scalars/dates/week_date.rs index b2844aa632b8..a05a103c1320 100644 --- a/common/functions/src/scalars/dates/week_date.rs +++ b/common/functions/src/scalars/dates/week_date.rs @@ -44,7 +44,7 @@ pub struct WeekFunction { pub trait WeekResultFunction { const IS_DETERMINISTIC: bool; - fn return_type() -> Result; + fn return_type() -> DataTypePtr; fn to_number(_value: DateTime, mode: u64) -> R; fn factor_function() -> Option> { None @@ -57,8 +57,8 @@ pub struct ToStartOfWeek; impl WeekResultFunction for ToStartOfWeek { const IS_DETERMINISTIC: bool = true; - fn return_type() -> Result { - Ok(Date16Type::arc()) + fn return_type() -> DataTypePtr { + Date16Type::arc() } fn to_number(value: DateTime, week_mode: u64) -> u32 { let mut weekday = value.weekday().number_from_sunday(); @@ -118,7 +118,7 @@ where self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { + fn return_type(&self) -> DataTypePtr { T::return_type() } diff --git a/common/functions/src/scalars/expressions/cast.rs b/common/functions/src/scalars/expressions/cast.rs index 55f9d188c9ca..4d0df897f242 100644 --- a/common/functions/src/scalars/expressions/cast.rs +++ b/common/functions/src/scalars/expressions/cast.rs @@ -64,8 +64,8 @@ impl Function for CastFunction { "CastFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.cast_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.cast_type.clone() } fn eval( diff --git a/common/functions/src/scalars/function.rs b/common/functions/src/scalars/function.rs index 6667c35eeff9..25bd63e9b63a 100644 --- a/common/functions/src/scalars/function.rs +++ b/common/functions/src/scalars/function.rs @@ -43,7 +43,7 @@ pub trait Function: fmt::Display + Sync + Send + DynClone { } /// The method returns the return_type of this function. - fn return_type(&self, args: &[&DataTypePtr]) -> Result; + fn return_type(&self) -> DataTypePtr; /// Evaluate the function, e.g. run/execute the function. fn eval( diff --git a/common/functions/src/scalars/function_adapter.rs b/common/functions/src/scalars/function_adapter.rs index 33cd657355c6..22728d5fa02e 100644 --- a/common/functions/src/scalars/function_adapter.rs +++ b/common/functions/src/scalars/function_adapter.rs @@ -83,18 +83,18 @@ impl Function for FunctionAdapter { self.inner.as_ref().map_or("null", |v| v.name()) } - fn return_type(&self, args: &[&DataTypePtr]) -> Result { + fn return_type(&self) -> DataTypePtr { if self.inner.is_none() { - return Ok(NullType::arc()); + return NullType::arc(); } let inner = self.inner.as_ref().unwrap(); - let typ = inner.return_type(args)?; + let typ = inner.return_type(); if self.has_nullable { - Ok(wrap_nullable(&typ)) + wrap_nullable(&typ) } else { - Ok(typ) + typ } } @@ -146,8 +146,7 @@ impl Function for FunctionAdapter { let (is_all_null, valid) = v.column().validity(); if is_all_null { // If only null, return null directly. - let args = columns.iter().map(|v| v.data_type()).collect::>(); - let inner_type = remove_nullable(&inner.return_type(args.as_slice())?); + let inner_type = remove_nullable(&inner.return_type()); return Ok(NullableColumn::wrap_inner( inner_type .create_constant_column(&inner_type.default_value(), input_rows)?, diff --git a/common/functions/src/scalars/hashes/city64_with_seed.rs b/common/functions/src/scalars/hashes/city64_with_seed.rs index 9ed3fa3d691f..d13f6b0a6cc7 100644 --- a/common/functions/src/scalars/hashes/city64_with_seed.rs +++ b/common/functions/src/scalars/hashes/city64_with_seed.rs @@ -110,8 +110,8 @@ impl Function for City64WithSeedFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(UInt64Type::arc()) + fn return_type(&self) -> DataTypePtr { + UInt64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/hashes/hash_base.rs b/common/functions/src/scalars/hashes/hash_base.rs index ad7bd3c5316f..f07db9c8823a 100644 --- a/common/functions/src/scalars/hashes/hash_base.rs +++ b/common/functions/src/scalars/hashes/hash_base.rs @@ -80,8 +80,8 @@ where self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(R::to_data_type()) + fn return_type(&self) -> DataTypePtr { + R::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/hashes/sha2hash.rs b/common/functions/src/scalars/hashes/sha2hash.rs index 3d294f5e7119..ee04c5b65222 100644 --- a/common/functions/src/scalars/hashes/sha2hash.rs +++ b/common/functions/src/scalars/hashes/sha2hash.rs @@ -65,8 +65,8 @@ impl Function for Sha2HashFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/logics/logic.rs b/common/functions/src/scalars/logics/logic.rs index 155564fa9619..7acee27155f1 100644 --- a/common/functions/src/scalars/logics/logic.rs +++ b/common/functions/src/scalars/logics/logic.rs @@ -87,11 +87,11 @@ where F: LogicExpression + Clone "LogicFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { + fn return_type(&self) -> DataTypePtr { if self.nullable { - Ok(NullableType::arc(BooleanType::arc())) + NullableType::arc(BooleanType::arc()) } else { - Ok(BooleanType::arc()) + BooleanType::arc() } } diff --git a/common/functions/src/scalars/maths/abs.rs b/common/functions/src/scalars/maths/abs.rs index a03655940885..6e71c855273f 100644 --- a/common/functions/src/scalars/maths/abs.rs +++ b/common/functions/src/scalars/maths/abs.rs @@ -92,8 +92,8 @@ impl Function for AbsFunction { "abs" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/maths/angle.rs b/common/functions/src/scalars/maths/angle.rs index ed9456a7f705..64fd048524f6 100644 --- a/common/functions/src/scalars/maths/angle.rs +++ b/common/functions/src/scalars/maths/angle.rs @@ -62,8 +62,8 @@ where T: AngleConvertFunction + Clone + Sync + Send + 'static "AngleFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/ceil.rs b/common/functions/src/scalars/maths/ceil.rs index 700b3d3a19bd..4b4887c2a1b5 100644 --- a/common/functions/src/scalars/maths/ceil.rs +++ b/common/functions/src/scalars/maths/ceil.rs @@ -62,8 +62,8 @@ impl Function for CeilFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/exp.rs b/common/functions/src/scalars/maths/exp.rs index 3d33a7742558..748af22ba44f 100644 --- a/common/functions/src/scalars/maths/exp.rs +++ b/common/functions/src/scalars/maths/exp.rs @@ -56,8 +56,8 @@ impl Function for ExpFunction { &*self._display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/floor.rs b/common/functions/src/scalars/maths/floor.rs index 107aada51bfc..c61d47ef6b34 100644 --- a/common/functions/src/scalars/maths/floor.rs +++ b/common/functions/src/scalars/maths/floor.rs @@ -61,8 +61,8 @@ impl Function for FloorFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/log.rs b/common/functions/src/scalars/maths/log.rs index 76d49e0a1d43..19a21c39a940 100644 --- a/common/functions/src/scalars/maths/log.rs +++ b/common/functions/src/scalars/maths/log.rs @@ -107,8 +107,8 @@ impl Function for GenericLogFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/pi.rs b/common/functions/src/scalars/maths/pi.rs index fd1391a2838b..9fd1c22057d1 100644 --- a/common/functions/src/scalars/maths/pi.rs +++ b/common/functions/src/scalars/maths/pi.rs @@ -45,8 +45,8 @@ impl Function for PiFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/pow.rs b/common/functions/src/scalars/maths/pow.rs index 022108ef76ae..c5fe29d13c66 100644 --- a/common/functions/src/scalars/maths/pow.rs +++ b/common/functions/src/scalars/maths/pow.rs @@ -64,8 +64,8 @@ impl Function for PowFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/random.rs b/common/functions/src/scalars/maths/random.rs index 06767a49e66d..af7839110a5b 100644 --- a/common/functions/src/scalars/maths/random.rs +++ b/common/functions/src/scalars/maths/random.rs @@ -55,8 +55,8 @@ impl Function for RandomFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/round.rs b/common/functions/src/scalars/maths/round.rs index a5a9c6c947f9..ef44a17ed112 100644 --- a/common/functions/src/scalars/maths/round.rs +++ b/common/functions/src/scalars/maths/round.rs @@ -85,8 +85,8 @@ impl Function for RoundingFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/sign.rs b/common/functions/src/scalars/maths/sign.rs index f39c38c18391..d4c2de9765ea 100644 --- a/common/functions/src/scalars/maths/sign.rs +++ b/common/functions/src/scalars/maths/sign.rs @@ -67,8 +67,8 @@ impl Function for SignFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Int8Type::arc()) + fn return_type(&self) -> DataTypePtr { + Int8Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/sqrt.rs b/common/functions/src/scalars/maths/sqrt.rs index f4b347e41708..18687197264c 100644 --- a/common/functions/src/scalars/maths/sqrt.rs +++ b/common/functions/src/scalars/maths/sqrt.rs @@ -56,8 +56,8 @@ impl Function for SqrtFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Float64Type::arc()) + fn return_type(&self) -> DataTypePtr { + Float64Type::arc() } fn eval( diff --git a/common/functions/src/scalars/maths/trigonometric.rs b/common/functions/src/scalars/maths/trigonometric.rs index 59e0a097d21a..0bd7bf195da9 100644 --- a/common/functions/src/scalars/maths/trigonometric.rs +++ b/common/functions/src/scalars/maths/trigonometric.rs @@ -73,8 +73,8 @@ impl Function for TrigonometricFunction { "TrigonometricFunction" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(f64::to_data_type()) + fn return_type(&self) -> DataTypePtr { + f64::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/others/exists.rs b/common/functions/src/scalars/others/exists.rs index 3ae913b09b55..640aa3f66856 100644 --- a/common/functions/src/scalars/others/exists.rs +++ b/common/functions/src/scalars/others/exists.rs @@ -45,11 +45,8 @@ impl Function for ExistsFunction { "ExistsFunction" } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(bool::to_data_type()) + fn return_type(&self) -> DataTypePtr { + bool::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/others/ignore.rs b/common/functions/src/scalars/others/ignore.rs index afa97664f196..d5558e9ba9b4 100644 --- a/common/functions/src/scalars/others/ignore.rs +++ b/common/functions/src/scalars/others/ignore.rs @@ -67,8 +67,8 @@ impl Function for IgnoreFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(BooleanType::arc()) + fn return_type(&self) -> DataTypePtr { + BooleanType::arc() } fn eval( diff --git a/common/functions/src/scalars/others/inet_aton.rs b/common/functions/src/scalars/others/inet_aton.rs index f48571b110f5..dce10b81cfe4 100644 --- a/common/functions/src/scalars/others/inet_aton.rs +++ b/common/functions/src/scalars/others/inet_aton.rs @@ -60,11 +60,11 @@ impl Function for InetAtonFunctionImpl Result { + fn return_type(&self) -> DataTypePtr { if SUPPRESS_PARSE_ERROR { - Ok(NullableType::arc(UInt32Type::arc())) + NullableType::arc(UInt32Type::arc()) } else { - Ok(UInt32Type::arc()) + UInt32Type::arc() } } diff --git a/common/functions/src/scalars/others/inet_ntoa.rs b/common/functions/src/scalars/others/inet_ntoa.rs index b1e279d1f53b..d67116b45540 100644 --- a/common/functions/src/scalars/others/inet_ntoa.rs +++ b/common/functions/src/scalars/others/inet_ntoa.rs @@ -61,11 +61,11 @@ impl Function for InetNtoaFunctionImpl Result { + fn return_type(&self) -> DataTypePtr { if SUPPRESS_CAST_ERROR { - Ok(NullableType::arc(StringType::arc())) + NullableType::arc(StringType::arc()) } else { - Ok(StringType::arc()) + StringType::arc() } } diff --git a/common/functions/src/scalars/others/running_difference_function.rs b/common/functions/src/scalars/others/running_difference_function.rs index dfebae594dd2..521037edafb7 100644 --- a/common/functions/src/scalars/others/running_difference_function.rs +++ b/common/functions/src/scalars/others/running_difference_function.rs @@ -83,8 +83,8 @@ impl Function for RunningDifferenceFunction { self.display_name.as_str() } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/others/sleep.rs b/common/functions/src/scalars/others/sleep.rs index ab6503aee1ec..300c4972efd6 100644 --- a/common/functions/src/scalars/others/sleep.rs +++ b/common/functions/src/scalars/others/sleep.rs @@ -15,6 +15,7 @@ use std::fmt; use std::time::Duration; +use common_datavalues::DataTypePtr; use common_datavalues::DataValue; use common_datavalues::Int8Type; use common_exception::ErrorCode; @@ -53,11 +54,8 @@ impl Function for SleepFunction { "SleepFunction" } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(Int8Type::arc()) + fn return_type(&self) -> DataTypePtr { + Int8Type::arc() } fn eval( diff --git a/common/functions/src/scalars/others/to_type_name.rs b/common/functions/src/scalars/others/to_type_name.rs index ec0f468edddd..c06d659b55d4 100644 --- a/common/functions/src/scalars/others/to_type_name.rs +++ b/common/functions/src/scalars/others/to_type_name.rs @@ -14,6 +14,7 @@ use std::fmt; +use common_datavalues::DataTypePtr; use common_datavalues::DataValue; use common_datavalues::StringType; use common_exception::Result; @@ -53,11 +54,8 @@ impl Function for ToTypeNameFunction { "ToTypeNameFunction" } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/semi_structureds/check_json.rs b/common/functions/src/scalars/semi_structureds/check_json.rs index 59de45afb6bf..aef4bb99b96d 100644 --- a/common/functions/src/scalars/semi_structureds/check_json.rs +++ b/common/functions/src/scalars/semi_structureds/check_json.rs @@ -48,8 +48,8 @@ impl Function for CheckJsonFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Arc::new(NullableType::create(StringType::arc()))) + fn return_type(&self) -> DataTypePtr { + Arc::new(NullableType::create(StringType::arc())) } fn eval( diff --git a/common/functions/src/scalars/semi_structureds/get.rs b/common/functions/src/scalars/semi_structureds/get.rs index d80436912bd9..46bc760dcbfa 100644 --- a/common/functions/src/scalars/semi_structureds/get.rs +++ b/common/functions/src/scalars/semi_structureds/get.rs @@ -80,8 +80,8 @@ impl Function &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(NullableType::arc(VariantType::arc())) + fn return_type(&self) -> DataTypePtr { + NullableType::arc(VariantType::arc()) } fn eval( diff --git a/common/functions/src/scalars/semi_structureds/parse_json.rs b/common/functions/src/scalars/semi_structureds/parse_json.rs index 38744111f744..916458cea243 100644 --- a/common/functions/src/scalars/semi_structureds/parse_json.rs +++ b/common/functions/src/scalars/semi_structureds/parse_json.rs @@ -77,8 +77,8 @@ impl Function for ParseJsonFunctionImpl Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/strings/bin.rs b/common/functions/src/scalars/strings/bin.rs index 51e48e55b2f1..86b311622edf 100644 --- a/common/functions/src/scalars/strings/bin.rs +++ b/common/functions/src/scalars/strings/bin.rs @@ -48,8 +48,8 @@ impl Function for BinFunction { "bin" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/strings/char_.rs b/common/functions/src/scalars/strings/char_.rs index bbac1142a847..bfd9cf450880 100644 --- a/common/functions/src/scalars/strings/char_.rs +++ b/common/functions/src/scalars/strings/char_.rs @@ -52,8 +52,8 @@ impl Function for CharFunction { "char" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/concat.rs b/common/functions/src/scalars/strings/concat.rs index dfea3a13f4b4..f65b051f639d 100644 --- a/common/functions/src/scalars/strings/concat.rs +++ b/common/functions/src/scalars/strings/concat.rs @@ -51,8 +51,8 @@ impl Function for ConcatFunction { "concat" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/concat_ws.rs b/common/functions/src/scalars/strings/concat_ws.rs index 310a6901ddfe..e2bd91be8862 100644 --- a/common/functions/src/scalars/strings/concat_ws.rs +++ b/common/functions/src/scalars/strings/concat_ws.rs @@ -163,8 +163,8 @@ impl Function for ConcatWsFunction { "concat_ws" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/strings/elt.rs b/common/functions/src/scalars/strings/elt.rs index 032901e41885..769ddca34f1d 100644 --- a/common/functions/src/scalars/strings/elt.rs +++ b/common/functions/src/scalars/strings/elt.rs @@ -78,8 +78,8 @@ impl Function for EltFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/strings/export_set.rs b/common/functions/src/scalars/strings/export_set.rs index fc2daa1b2f4d..e8004df89215 100644 --- a/common/functions/src/scalars/strings/export_set.rs +++ b/common/functions/src/scalars/strings/export_set.rs @@ -65,8 +65,8 @@ impl Function for ExportSetFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/field.rs b/common/functions/src/scalars/strings/field.rs index 380a04eca258..5c4d837fd99f 100644 --- a/common/functions/src/scalars/strings/field.rs +++ b/common/functions/src/scalars/strings/field.rs @@ -51,8 +51,8 @@ impl Function for FieldFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(u64::to_data_type()) + fn return_type(&self) -> DataTypePtr { + u64::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/find_in_set.rs b/common/functions/src/scalars/strings/find_in_set.rs index 6c597ccd3c68..176496276610 100644 --- a/common/functions/src/scalars/strings/find_in_set.rs +++ b/common/functions/src/scalars/strings/find_in_set.rs @@ -49,8 +49,8 @@ impl Function for FindInSetFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(u64::to_data_type()) + fn return_type(&self) -> DataTypePtr { + u64::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/format.rs b/common/functions/src/scalars/strings/format.rs index b1821c07ea3f..ee5edd1e4e36 100644 --- a/common/functions/src/scalars/strings/format.rs +++ b/common/functions/src/scalars/strings/format.rs @@ -66,8 +66,8 @@ impl Function for FormatFunction { "format" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/hex.rs b/common/functions/src/scalars/strings/hex.rs index 22e4990287e4..42c704f9eb61 100644 --- a/common/functions/src/scalars/strings/hex.rs +++ b/common/functions/src/scalars/strings/hex.rs @@ -55,8 +55,8 @@ impl Function for HexFunction { "hex" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/strings/insert.rs b/common/functions/src/scalars/strings/insert.rs index 97ad379f1b2a..63400a5170c9 100644 --- a/common/functions/src/scalars/strings/insert.rs +++ b/common/functions/src/scalars/strings/insert.rs @@ -78,8 +78,8 @@ impl Function for InsertFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/leftright.rs b/common/functions/src/scalars/strings/leftright.rs index ed9c8c246f3d..17aa65ce4304 100644 --- a/common/functions/src/scalars/strings/leftright.rs +++ b/common/functions/src/scalars/strings/leftright.rs @@ -76,8 +76,8 @@ impl Function for LeftRightFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/locate.rs b/common/functions/src/scalars/strings/locate.rs index b760a51252a5..896103f7796a 100644 --- a/common/functions/src/scalars/strings/locate.rs +++ b/common/functions/src/scalars/strings/locate.rs @@ -66,8 +66,8 @@ impl Function for LocatingFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(u64::to_data_type()) + fn return_type(&self) -> DataTypePtr { + u64::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/oct.rs b/common/functions/src/scalars/strings/oct.rs index b121b6f4db30..fcbeb2c3d730 100644 --- a/common/functions/src/scalars/strings/oct.rs +++ b/common/functions/src/scalars/strings/oct.rs @@ -74,8 +74,8 @@ impl Function for OctFunction { "oct" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/strings/pad.rs b/common/functions/src/scalars/strings/pad.rs index 7406476649db..9a433293104c 100644 --- a/common/functions/src/scalars/strings/pad.rs +++ b/common/functions/src/scalars/strings/pad.rs @@ -116,8 +116,8 @@ impl Function for PadFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/regexp_instr.rs b/common/functions/src/scalars/strings/regexp_instr.rs index 0febf377f616..b464d0ecd07f 100644 --- a/common/functions/src/scalars/strings/regexp_instr.rs +++ b/common/functions/src/scalars/strings/regexp_instr.rs @@ -70,8 +70,8 @@ impl Function for RegexpInStrFunction { &self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(u64::to_data_type()) + fn return_type(&self) -> DataTypePtr { + u64::to_data_type() } // Notes: https://dev.mysql.com/doc/refman/8.0/en/regexp.html#function_regexp-instr diff --git a/common/functions/src/scalars/strings/regexp_like.rs b/common/functions/src/scalars/strings/regexp_like.rs index 44156cd9fca2..af353ea8f307 100644 --- a/common/functions/src/scalars/strings/regexp_like.rs +++ b/common/functions/src/scalars/strings/regexp_like.rs @@ -60,8 +60,8 @@ impl Function for RegexpLikeFunction { &self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(BooleanType::arc()) + fn return_type(&self) -> DataTypePtr { + BooleanType::arc() } // Notes: https://dev.mysql.com/doc/refman/8.0/en/regexp.html#function_regexp-like fn eval( diff --git a/common/functions/src/scalars/strings/regexp_substr.rs b/common/functions/src/scalars/strings/regexp_substr.rs index 722f5b4a21d8..2b1936fa03ce 100644 --- a/common/functions/src/scalars/strings/regexp_substr.rs +++ b/common/functions/src/scalars/strings/regexp_substr.rs @@ -70,8 +70,8 @@ impl Function for RegexpSubStrFunction { &self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Arc::new(NullableType::create(StringType::arc()))) + fn return_type(&self) -> DataTypePtr { + Arc::new(NullableType::create(StringType::arc())) } // Notes: https://dev.mysql.com/doc/refman/8.0/en/regexp.html#function_regexp-substr diff --git a/common/functions/src/scalars/strings/repeat.rs b/common/functions/src/scalars/strings/repeat.rs index b836a97d4a40..1ae5576a18d9 100644 --- a/common/functions/src/scalars/strings/repeat.rs +++ b/common/functions/src/scalars/strings/repeat.rs @@ -62,8 +62,8 @@ impl Function for RepeatFunction { "repeat" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/strings/replace.rs b/common/functions/src/scalars/strings/replace.rs index fcc9fe0e95f4..79b9f572252f 100644 --- a/common/functions/src/scalars/strings/replace.rs +++ b/common/functions/src/scalars/strings/replace.rs @@ -69,8 +69,8 @@ impl Function for ReplaceFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/space.rs b/common/functions/src/scalars/strings/space.rs index cf05fed29d90..50e8c101661d 100644 --- a/common/functions/src/scalars/strings/space.rs +++ b/common/functions/src/scalars/strings/space.rs @@ -52,8 +52,8 @@ impl Function for SpaceFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(Vu8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + Vu8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/strcmp.rs b/common/functions/src/scalars/strings/strcmp.rs index 5afe9e8da3ca..67cc2e52903f 100644 --- a/common/functions/src/scalars/strings/strcmp.rs +++ b/common/functions/src/scalars/strings/strcmp.rs @@ -52,8 +52,8 @@ impl Function for StrcmpFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(i8::to_data_type()) + fn return_type(&self) -> DataTypePtr { + i8::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/string2number.rs b/common/functions/src/scalars/strings/string2number.rs index aef90583aa31..586cc75f7105 100644 --- a/common/functions/src/scalars/strings/string2number.rs +++ b/common/functions/src/scalars/strings/string2number.rs @@ -84,8 +84,8 @@ where &self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(R::to_data_type()) + fn return_type(&self) -> DataTypePtr { + R::to_data_type() } fn eval( diff --git a/common/functions/src/scalars/strings/string2string.rs b/common/functions/src/scalars/strings/string2string.rs index 3454c5cd54ad..ee9e1670fcad 100644 --- a/common/functions/src/scalars/strings/string2string.rs +++ b/common/functions/src/scalars/strings/string2string.rs @@ -68,8 +68,8 @@ impl Function for String2StringFunction { &self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/strings/substring.rs b/common/functions/src/scalars/strings/substring.rs index 281fa4da4d44..69b47338fda8 100644 --- a/common/functions/src/scalars/strings/substring.rs +++ b/common/functions/src/scalars/strings/substring.rs @@ -78,8 +78,8 @@ impl Function for SubstringFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/strings/substring_index.rs b/common/functions/src/scalars/strings/substring_index.rs index fd950c9f482a..db53cb354c40 100644 --- a/common/functions/src/scalars/strings/substring_index.rs +++ b/common/functions/src/scalars/strings/substring_index.rs @@ -74,8 +74,8 @@ impl Function for SubstringIndexFunction { &*self.display_name } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/strings/unhex.rs b/common/functions/src/scalars/strings/unhex.rs index 36c879a2dc14..d4aa11770e0f 100644 --- a/common/functions/src/scalars/strings/unhex.rs +++ b/common/functions/src/scalars/strings/unhex.rs @@ -53,8 +53,8 @@ impl Function for UnhexFunction { "unhex" } - fn return_type(&self, _args: &[&DataTypePtr]) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/tuples/tuple.rs b/common/functions/src/scalars/tuples/tuple.rs index 2cbb65015271..6c2f1dde47f0 100644 --- a/common/functions/src/scalars/tuples/tuple.rs +++ b/common/functions/src/scalars/tuples/tuple.rs @@ -62,11 +62,8 @@ impl Function for TupleFunction { "TupleFunction" } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(self.result_type.clone()) + fn return_type(&self) -> DataTypePtr { + self.result_type.clone() } fn eval( diff --git a/common/functions/src/scalars/uuids/uuid_creator.rs b/common/functions/src/scalars/uuids/uuid_creator.rs index 2cd7dfe753e6..44aa890fcdc2 100644 --- a/common/functions/src/scalars/uuids/uuid_creator.rs +++ b/common/functions/src/scalars/uuids/uuid_creator.rs @@ -17,6 +17,7 @@ use std::marker::PhantomData; use common_datavalues::Column; use common_datavalues::ConstColumn; +use common_datavalues::DataTypePtr; use common_datavalues::NewColumn; use common_datavalues::StringColumn; use common_datavalues::StringType; @@ -90,11 +91,8 @@ where T: UUIDCreator + Clone + Sync + Send + 'static self.display_name.as_str() } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(StringType::arc()) + fn return_type(&self) -> DataTypePtr { + StringType::arc() } fn eval( diff --git a/common/functions/src/scalars/uuids/uuid_verifier.rs b/common/functions/src/scalars/uuids/uuid_verifier.rs index 126189ee154c..c4ff97de98a7 100644 --- a/common/functions/src/scalars/uuids/uuid_verifier.rs +++ b/common/functions/src/scalars/uuids/uuid_verifier.rs @@ -19,6 +19,7 @@ use std::sync::Arc; use common_datavalues::BooleanColumn; use common_datavalues::BooleanType; +use common_datavalues::DataTypePtr; use common_datavalues::Scalar; use common_datavalues::ScalarColumn; use common_datavalues::ScalarViewer; @@ -115,11 +116,8 @@ where T: UUIDVerifier + Clone + Sync + Send + 'static self.display_name.as_str() } - fn return_type( - &self, - _args: &[&common_datavalues::DataTypePtr], - ) -> Result { - Ok(BooleanType::arc()) + fn return_type(&self) -> DataTypePtr { + BooleanType::arc() } fn eval( diff --git a/common/functions/tests/it/scalars/scalar_function_test.rs b/common/functions/tests/it/scalars/scalar_function_test.rs index 685f4b04b3bd..220f5a8e5431 100644 --- a/common/functions/tests/it/scalars/scalar_function_test.rs +++ b/common/functions/tests/it/scalars/scalar_function_test.rs @@ -119,7 +119,7 @@ pub fn test_eval_with_type( arguments_type: &[&DataTypePtr], ) -> Result { let func = FunctionFactory::instance().get(op, arguments_type)?; - func.return_type(arguments_type)?; + func.return_type(); let func_ctx = FunctionContext { tz: None }; func.eval(arguments, rows_size, func_ctx) } diff --git a/common/planners/src/plan_expression_chain.rs b/common/planners/src/plan_expression_chain.rs index 636a1c90c5a7..1e0fe3e20351 100644 --- a/common/planners/src/plan_expression_chain.rs +++ b/common/planners/src/plan_expression_chain.rs @@ -127,7 +127,7 @@ impl ExpressionChain { let arg_types = vec![nested_expr.to_data_type(&self.schema)?]; let arg_types2: Vec<&DataTypePtr> = arg_types.iter().collect(); let func = FunctionFactory::instance().get(op, &arg_types2)?; - let return_type = func.return_type(&arg_types2)?; + let return_type = func.return_type(); let function = ActionFunction { name: expr.column_name(), @@ -149,7 +149,7 @@ impl ExpressionChain { let arg_types2: Vec<&DataTypePtr> = arg_types.iter().collect(); let func = FunctionFactory::instance().get(op, &arg_types2)?; - let return_type = func.return_type(&arg_types2)?; + let return_type = func.return_type(); let function = ActionFunction { name: expr.column_name(), @@ -172,7 +172,7 @@ impl ExpressionChain { let arg_types2: Vec<&DataTypePtr> = arg_types.iter().collect(); let func = FunctionFactory::instance().get(op, &arg_types2)?; - let return_type = func.return_type(&arg_types2)?; + let return_type = func.return_type(); let function = ActionFunction { name: expr.column_name(), diff --git a/common/planners/src/plan_expression_common.rs b/common/planners/src/plan_expression_common.rs index 261c9941bb8e..ed3c2293f462 100644 --- a/common/planners/src/plan_expression_common.rs +++ b/common/planners/src/plan_expression_common.rs @@ -409,7 +409,7 @@ impl ExpressionDataTypeVisitor { let arguments: Vec<&DataTypePtr> = arguments.iter().collect(); let function = FunctionFactory::instance().get(op, &arguments)?; - let return_type = function.return_type(&arguments)?; + let return_type = function.return_type(); self.stack.push(return_type); Ok(self) } diff --git a/common/planners/src/plan_expression_monotonicity.rs b/common/planners/src/plan_expression_monotonicity.rs index a833a882c508..dadc984091da 100644 --- a/common/planners/src/plan_expression_monotonicity.rs +++ b/common/planners/src/plan_expression_monotonicity.rs @@ -135,7 +135,7 @@ impl ExpressionMonotonicityVisitor { let arg_types: Vec<&DataTypePtr> = arg_types.iter().collect(); let func = instance.get(op, &arg_types)?; - let return_type = func.return_type(&arg_types)?; + let return_type = func.return_type(); let mut monotonic = match self.single_point { false => func.get_monotonicity(monotonicity_vec.as_ref())?, true => {