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

Function test_count_dense_union_sliced_nulls

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

Source from the content-addressed store, hash-verified

3079
3080
3081def test_count_dense_union_sliced_nulls():
3082 # GH-50113: Sliced unions can report incorrect null counts in count.
3083 arr = pa.UnionArray.from_dense(
3084 pa.array([0, 1, 0, 0, 1, 1], type=pa.int8()),
3085 pa.array([0, 0, 1, 2, 1, 2], type=pa.int32()),
3086 [
3087 pa.array([0.5, None, 3.0]),
3088 pa.array([None, True, False]),
3089 ]
3090 )
3091
3092 # Logical array: [0.5, None, None, 3.0, True, False].
3093 assert pc.count(arr, mode="only_valid").as_py() == 4
3094 assert pc.count(arr, mode="only_null").as_py() == 2
3095 assert pc.count(arr, mode="all").as_py() == 6
3096 # Logical slice: [None, None, 3.0, True].
3097 assert pc.count(arr.slice(1, 4), mode="only_valid").as_py() == 2
3098 assert pc.count(arr.slice(1, 4), mode="only_null").as_py() == 2
3099
3100
3101def test_index():

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