vibhatha commented on code in PR #12590:
URL: https://github.com/apache/arrow/pull/12590#discussion_r843921002


##########
python/pyarrow/_compute.pyx:
##########
@@ -2251,3 +2325,158 @@ cdef CExpression _bind(Expression filter, Schema 
schema) except *:
 
     return GetResultValue(filter.unwrap().Bind(
         deref(pyarrow_unwrap_schema(schema).get())))
+
+
+cdef CFunctionDoc _make_function_doc(dict func_doc) except *:
+    """
+    Helper function to generate the FunctionDoc
+    """
+    cdef:
+        CFunctionDoc f_doc
+        vector[c_string] c_arg_names
+        c_bool c_options_required
+
+    validate_expr = "summary" in func_doc.keys(
+    ) and "description" in func_doc.keys() and "arg_names" in func_doc.keys()
+    if not validate_expr:
+        raise ValueError(
+            "function doc dictionary must contain, summary, arg_names and a 
description")
+    f_doc.summary = tobytes(func_doc["summary"])
+    f_doc.description = tobytes(func_doc["description"])
+    for arg_name in func_doc["arg_names"]:
+        c_arg_names.push_back(tobytes(arg_name))
+    f_doc.arg_names = c_arg_names
+    # UDFOptions integration:
+    # TODO: https://issues.apache.org/jira/browse/ARROW-16041
+    f_doc.options_class = tobytes("None")
+    c_options_required = False
+    f_doc.options_required = c_options_required
+    return f_doc
+
+
+def register_scalar_function(func_name, num_args, function_doc, in_types,
+                             out_type, function):
+    """
+    Register a user-defined-function.
+
+    Parameters
+    ----------
+
+    func_name : str
+        Name of the function. This name must be globally unique. 
+    num_args : int
+       Number of arguments in the function.
+       When defining a function with variable arguments, 

Review Comment:
   Yes that's right. Good catch. 



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to