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

Function test_sum_chunked_array

python/pyarrow/tests/test_compute.py:412–431  ·  view source on GitHub ↗
(arrow_type)

Source from the content-addressed store, hash-verified

410
411@pytest.mark.parametrize('arrow_type', numerical_arrow_types)
412def test_sum_chunked_array(arrow_type):
413 arr = pa.chunked_array([pa.array([1, 2, 3, 4], type=arrow_type)])
414 assert pc.sum(arr).as_py() == 10
415
416 arr = pa.chunked_array([
417 pa.array([1, 2], type=arrow_type), pa.array([3, 4], type=arrow_type)
418 ])
419 assert pc.sum(arr).as_py() == 10
420
421 arr = pa.chunked_array([
422 pa.array([1, 2], type=arrow_type),
423 pa.array([], type=arrow_type),
424 pa.array([3, 4], type=arrow_type)
425 ])
426 assert pc.sum(arr).as_py() == 10
427
428 arr = pa.chunked_array((), type=arrow_type)
429 assert arr.num_chunks == 0
430 assert pc.sum(arr).as_py() is None # noqa: E711
431 assert pc.sum(arr, min_count=0).as_py() == 0
432
433
434@pytest.mark.parametrize('arrow_type', [pa.decimal128(3, 2), pa.decimal256(3, 2)])

Callers

nothing calls this directly

Calls 4

chunked_arrayMethod · 0.80
as_pyMethod · 0.80
arrayMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected