viirya commented on code in PR #8648:
URL: https://github.com/apache/arrow-datafusion/pull/8648#discussion_r1436133225
##########
datafusion/sqllogictest/src/test_context.rs:
##########
@@ -348,3 +353,58 @@ pub async fn register_metadata_tables(ctx:
&SessionContext) {
ctx.register_batch("table_with_metadata", batch).unwrap();
}
+
+/// Create a UDF function named "example"
+fn create_example_udf() -> ScalarUDF {
+ // First, declare the actual implementation of the calculation
+ let adder = |args: &[ArrayRef]| {
+ // in DataFusion, all `args` and output are dynamically-typed arrays,
which means that we need to:
+ // 1. cast the values to the type we want
+ // 2. perform the computation for every element in the array (using a
loop or SIMD) and construct the result
+
+ // this is guaranteed by DataFusion based on the function's signature.
+ assert_eq!(args.len(), 2);
Review Comment:
Seems this `create_example_udf` is copied from other place. These comments
used to explain how `ScalarUDF` works can be removed 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]