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

Function unary_agg_func_fixture

python/pyarrow/conftest.py:331–353  ·  view source on GitHub ↗

Register a unary aggregate function (mean)

()

Source from the content-addressed store, hash-verified

329
330@pytest.fixture(scope="session")
331def unary_agg_func_fixture():
332 """
333 Register a unary aggregate function (mean)
334 """
335 from pyarrow import compute as pc
336 import numpy as np
337
338 def func(ctx, x):
339 return pa.scalar(np.nanmean(x))
340
341 func_name = "mean_udf"
342 func_doc = {"summary": "y=avg(x)",
343 "description": "find mean of x"}
344
345 pc.register_aggregate_function(func,
346 func_name,
347 func_doc,
348 {
349 "x": pa.float64(),
350 },
351 pa.float64()
352 )
353 return func, func_name
354
355
356@pytest.fixture(scope="session")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected