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

Function test_group_by_ordering

python/pyarrow/tests/test_exec_plan.py:326–337  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

324
325
326def test_group_by_ordering():
327 # GH-36709 - preserve ordering in groupby by setting use_threads=False
328 table1 = pa.table({'a': [1, 2, 3, 4], 'b': ['a'] * 4})
329 table2 = pa.table({'a': [1, 2, 3, 4], 'b': ['b'] * 4})
330 table = pa.concat_tables([table1, table2])
331
332 for _ in range(50):
333 # 50 seems to consistently cause errors when order is not preserved.
334 # If the order problem is reintroduced this test will become flaky
335 # which is still a signal that the order is not preserved.
336 result = table.group_by("b", use_threads=False).aggregate([])
337 assert result["b"] == pa.chunked_array([["a"], ["b"]])

Callers

nothing calls this directly

Calls 2

aggregateMethod · 0.80
chunked_arrayMethod · 0.80

Tested by

no test coverage detected