findepi commented on code in PR #17872:
URL: https://github.com/apache/datafusion/pull/17872#discussion_r2404131731
##########
datafusion/expr/src/async_udf.rs:
##########
@@ -132,3 +128,128 @@ impl Display for AsyncScalarUDF {
write!(f, "AsyncScalarUDF: {}", self.inner.name())
}
}
+
+#[cfg(test)]
+mod tests {
+ use std::{collections::HashSet, sync::Arc};
+
+ use arrow::datatypes::DataType;
+ use async_trait::async_trait;
+ use datafusion_common::error::Result;
+ use datafusion_expr_common::{columnar_value::ColumnarValue,
signature::Signature};
+
+ use crate::{
+ async_udf::{AsyncScalarUDF, AsyncScalarUDFImpl},
+ ScalarFunctionArgs, ScalarUDFImpl,
+ };
+
+ #[derive(Debug, PartialEq, Eq, Hash, Clone)]
+ struct TestAsyncUDFImpl1 {
+ a: i32,
+ }
+
+ impl ScalarUDFImpl for TestAsyncUDFImpl1 {
+ fn as_any(&self) -> &dyn std::any::Any {
+ self
+ }
+
+ fn name(&self) -> &str {
+ todo!()
+ }
+
+ fn signature(&self) -> &Signature {
+ todo!()
+ }
+
+ fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
+ todo!()
+ }
+
+ fn invoke_with_args(&self, _args: ScalarFunctionArgs) ->
Result<ColumnarValue> {
+ todo!()
+ }
+ }
+
+ #[async_trait]
+ impl AsyncScalarUDFImpl for TestAsyncUDFImpl1 {
+ async fn invoke_async_with_args(
+ &self,
+ _args: ScalarFunctionArgs,
+ ) -> Result<ColumnarValue> {
+ todo!()
+ }
+ }
+
+ #[derive(Debug, PartialEq, Eq, Hash, Clone)]
+ struct TestAsyncUDFImpl2 {
+ a: i32,
+ }
+
+ impl ScalarUDFImpl for TestAsyncUDFImpl2 {
+ fn as_any(&self) -> &dyn std::any::Any {
+ self
+ }
+
+ fn name(&self) -> &str {
+ todo!()
+ }
+
+ fn signature(&self) -> &Signature {
+ todo!()
+ }
+
+ fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
+ todo!()
+ }
+
+ fn invoke_with_args(&self, _args: ScalarFunctionArgs) ->
Result<ColumnarValue> {
+ todo!()
+ }
+ }
+
+ #[async_trait]
+ impl AsyncScalarUDFImpl for TestAsyncUDFImpl2 {
+ async fn invoke_async_with_args(
+ &self,
+ _args: ScalarFunctionArgs,
+ ) -> Result<ColumnarValue> {
+ todo!()
+ }
+ }
+
+ #[test]
+ fn udf_equality_and_hash() {
Review Comment:
No, let's not add it here.
--
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]