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

Function test_group_by_sliced_any_all

python/pyarrow/tests/test_table.py:3088–3116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3086
3087@pytest.mark.acero
3088def test_group_by_sliced_any_all():
3089 # GH-50043: hash_any/hash_all produce incorrect results on sliced boolean arrays
3090 # Row 0 will be discarded by slice, should not affect aggregation
3091 table = pa.table(
3092 {
3093 "g": [99, 10, 10],
3094 "any_arg": [True, False, None],
3095 "all_arg": [False, True, None],
3096 }
3097 )
3098 sliced = table.slice(1)
3099
3100 expected = pa.table(
3101 {
3102 "g": [10],
3103 "any_arg_any": [False],
3104 "all_arg_all": [True],
3105 }
3106 )
3107
3108 # any(False, None) = False, all(True, None) = True
3109 for use_threads in [False, True]:
3110 result = sliced.group_by("g", use_threads=use_threads).aggregate(
3111 [
3112 ("any_arg", "any"),
3113 ("all_arg", "all"),
3114 ]
3115 )
3116 assert result.equals(expected)
3117
3118
3119@pytest.mark.acero

Callers

nothing calls this directly

Calls 3

aggregateMethod · 0.80
equalsMethod · 0.80
sliceMethod · 0.45

Tested by

no test coverage detected