comphead commented on code in PR #19518:
URL: https://github.com/apache/datafusion/pull/19518#discussion_r2653951170
##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -39,45 +39,81 @@ use datafusion_expr_common::{
use itertools::Itertools as _;
use std::sync::Arc;
+/// Extension trait to unify common functionality between [`ScalarUDF`],
[`AggregateUDF`]
+/// and [`WindowUDF`] for use by signature coercion functions.
+pub trait UDFCoercionExt {
+ /// Should delegate to [`ScalarUDF::name`], [`AggregateUDF::name`] or
[`WindowUDF::name`].
+ fn name(&self) -> &str;
+ /// Should delegate to [`ScalarUDF::signature`],
[`AggregateUDF::signature`]
+ /// or [`WindowUDF::signature`].
+ fn signature(&self) -> &Signature;
+ /// Should delegate to [`ScalarUDF::coerce_types`],
[`AggregateUDF::coerce_types`]
+ /// or [`WindowUDF::coerce_types`].
+ fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>>;
+}
+
+impl UDFCoercionExt for ScalarUDF {
+ fn name(&self) -> &str {
Review Comment:
its bad the specialization feature is in nightly releases, so we could get
rid of those parts
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]