You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/11 16:11:00 UTC

[GitHub] [arrow-datafusion] isidentical commented on a diff in pull request #3765: Allow specialized implementations to produce hints for the array adapter

isidentical commented on code in PR #3765:
URL: https://github.com/apache/arrow-datafusion/pull/3765#discussion_r992528863


##########
datafusion/physical-expr/src/functions.rs:
##########
@@ -253,6 +253,28 @@ macro_rules! invoke_if_unicode_expressions_feature_flag {
 /// decorates a function to handle [`ScalarValue`]s by converting them to arrays before calling the function
 /// and vice-versa after evaluation.
 pub fn make_scalar_function<F>(inner: F) -> ScalarFunctionImplementation
+where
+    F: Fn(&[ArrayRef]) -> Result<ArrayRef> + Sync + Send + 'static,
+{
+    make_scalar_function_with_hints(inner, vec![])
+}
+
+/// Just like [`make_scalar_function`], decorates the given function to handle both [`ScalarValue`]s and arrays.
+/// Additionally can receive a `hints` vector which can be used to control the output arrays when generating them
+/// from [`ScalarValue`]s.
+///
+/// Each element of the `hints` vector gets mapped to the corresponding argument of the function. The number of hints
+/// can be less or greater than the number of arguments (for functions with variable number of arguments). Each unmapped
+/// argument will assume the default hint.
+///
+/// Hints:

Review Comment:
   I was initially going for a rather simple approach, but I think it makes sense to at least use enums, thanks @alamb! 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org