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

Function test_table_group_by_first

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

Source from the content-addressed store, hash-verified

3118
3119@pytest.mark.acero
3120def test_table_group_by_first():
3121 # "first" is an ordered aggregation -> requires to specify use_threads=False
3122 table1 = pa.table({'a': [1, 2, 3, 4], 'b': ['a', 'b'] * 2})
3123 table2 = pa.table({'a': [1, 2, 3, 4], 'b': ['b', 'a'] * 2})
3124 table = pa.concat_tables([table1, table2])
3125
3126 with pytest.raises(NotImplementedError):
3127 table.group_by("b").aggregate([("a", "first")])
3128
3129 result = table.group_by("b", use_threads=False).aggregate([("a", "first")])
3130 expected = pa.table({"b": ["a", "b"], "a_first": [1, 2]})
3131 assert result.equals(expected)
3132
3133
3134@pytest.mark.acero

Callers

nothing calls this directly

Calls 2

aggregateMethod · 0.80
equalsMethod · 0.80

Tested by

no test coverage detected