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

Function varargs_agg_func_fixture

python/pyarrow/conftest.py:357–383  ·  view source on GitHub ↗

Register a unary aggregate function

()

Source from the content-addressed store, hash-verified

355
356@pytest.fixture(scope="session")
357def varargs_agg_func_fixture():
358 """
359 Register a unary aggregate function
360 """
361 from pyarrow import compute as pc
362 import numpy as np
363
364 def func(ctx, *args):
365 sum = 0.0
366 for arg in args:
367 sum += np.nanmean(arg)
368 return pa.scalar(sum)
369
370 func_name = "sum_mean"
371 func_doc = {"summary": "Varargs aggregate",
372 "description": "Varargs aggregate"}
373
374 pc.register_aggregate_function(func,
375 func_name,
376 func_doc,
377 {
378 "x": pa.int64(),
379 "y": pa.float64()
380 },
381 pa.float64()
382 )
383 return func, func_name

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected