pyarrow.compute.ScalarUdfContext

class pyarrow.compute.ScalarUdfContext

Bases: _Weakrefable

Per-invocation function context/state.

This object will always be the first argument to a user-defined function. It should not be used outside of a call to the function.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

Attributes

batch_length

The common length of all input arguments (int).

memory_pool

A memory pool for allocations (MemoryPool).

batch_length

The common length of all input arguments (int).

In the case that all arguments are scalars, this value is used to pass the “actual length” of the arguments, e.g. because the scalar values are encoding a column with a constant value.

memory_pool

A memory pool for allocations (MemoryPool).

This is the memory pool supplied by the user when they invoked the function and it should be used in any calls to arrow that the UDF makes if that call accepts a memory_pool.