vibhatha commented on a change in pull request #12590:
URL: https://github.com/apache/arrow/pull/12590#discussion_r831739519



##########
File path: python/examples/udf/udf_example.py
##########
@@ -0,0 +1,322 @@
+from typing import List
+import pyarrow as pa
+from pyarrow import compute as pc
+from pyarrow.compute import register_function
+from pyarrow.compute import Arity, InputType
+
+
+def get_function_doc(summary: str, desc: str, arg_names: List[str],
+                     options_class: str, options_required: bool = False):
+    func_doc = {}
+    func_doc["summary"] = summary
+    func_doc["description"] = desc
+    func_doc["arg_names"] = arg_names
+    func_doc["options_class"] = options_class
+    func_doc["options_required"] = False
+    return func_doc
+
+
+"""
+Array Usage
+"""
+
+# Example 1: Array Unary
+print("=" * 80)
+print("Example 1: Array Unary")
+print("=" * 80)
+
+
+def add_constant(array):
+    return pc.call_function("add", [array, 1])
+
+
+func_name_1 = "py_add_func"
+arity_1 = Arity.unary()
+in_types_1 = [InputType.array(pa.int64())]
+out_type_1 = pa.int64()
+doc_1 = get_function_doc("add function", "test add function",
+                         ["value"], "None")

Review comment:
       of course. that's better. 




-- 
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]


Reply via email to