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

Function test_count_sparse_union_sliced_nulls

python/pyarrow/tests/test_compute.py:3062–3078  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3060
3061
3062def test_count_sparse_union_sliced_nulls():
3063 # GH-50113: Sliced unions can report incorrect null counts in count.
3064 arr = pa.UnionArray.from_sparse(
3065 pa.array([0, 1, 0, 0, 1, 1], type=pa.int8()),
3066 [
3067 pa.array([0.5, 99.0, None, 3.0, 88.0, 77.0]),
3068 pa.array([False, None, True, False, True, False]),
3069 ]
3070 )
3071
3072 # Logical array: [0.5, None, None, 3.0, True, False].
3073 assert pc.count(arr, mode="only_valid").as_py() == 4
3074 assert pc.count(arr, mode="only_null").as_py() == 2
3075 assert pc.count(arr, mode="all").as_py() == 6
3076 # Logical slice: [None, None, 3.0, True].
3077 assert pc.count(arr.slice(1, 4), mode="only_valid").as_py() == 2
3078 assert pc.count(arr.slice(1, 4), mode="only_null").as_py() == 2
3079
3080
3081def test_count_dense_union_sliced_nulls():

Callers

nothing calls this directly

Calls 4

as_pyMethod · 0.80
arrayMethod · 0.45
countMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected