MCPcopy Create free account
hub / github.com/apache/arrow / ephemeral_nullary_func_fixture

Function ephemeral_nullary_func_fixture

python/pyarrow/tests/test_udf.py:226–247  ·  view source on GitHub ↗

Register a nullary scalar function with an ephemeral Python function. This stresses that the Python function object is properly kept alive by the registered function.

()

Source from the content-addressed store, hash-verified

224
225@pytest.fixture(scope="session")
226def ephemeral_nullary_func_fixture():
227 """
228 Register a nullary scalar function with an ephemeral Python function.
229 This stresses that the Python function object is properly kept alive by the
230 registered function.
231 """
232 def nullary_func(context):
233 return pa.array([42] * context.batch_length, type=pa.int64(),
234 memory_pool=context.memory_pool)
235
236 func_doc = {
237 "summary": "random function",
238 "description": "generates a random value"
239 }
240 func_name = "test_ephemeral_nullary_func"
241 pc.register_scalar_function(nullary_func,
242 func_name,
243 func_doc,
244 {},
245 pa.int64())
246
247 return func_name
248
249
250@pytest.fixture(scope="session")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected