pyarrow.compute.register_tabular_function#

pyarrow.compute.register_tabular_function(func, function_name, function_doc, in_types, out_type, func_registry=None)#

Register a user-defined tabular function.

This API is EXPERIMENTAL.

A tabular function is one accepting a context argument of type UdfContext and returning a generator of struct arrays. The in_types argument must be empty and the out_type argument specifies a schema. Each struct array must have field types corresponding to the schema.

Parameters:
funccallable()

A callable implementing the user-defined function. The only argument is the context argument of type UdfContext. It must return a callable that returns on each invocation a StructArray matching the out_type, where an empty array indicates end.

function_namestr

Name of the function. There should only be one function registered with this name in the function registry.

function_docdict

A dictionary object with keys “summary” (str), and “description” (str).

in_typesDict[str, DataType]

Must be an empty dictionary (reserved for future use).

out_typeUnion[Schema, DataType]

Schema of the function’s output, or a corresponding flat struct type.

func_registryFunctionRegistry

Optional function registry to use instead of the default global one.