westonpace commented on issue #37055:
URL: https://github.com/apache/arrow/issues/37055#issuecomment-1690179765
I'm not entirely sure I understand the goal. The aggregate operations do
have standalone python bindings. For example:
```
>>> import pyarrow as pa
>>> x = pa.chunked_array([[1, 2, 3, 4, 5], [6, 7, 8, 9]])
>>> import pyarrow.compute as pc
>>> pc.sum(x)
<pyarrow.Int64Scalar: 45>
```
However, the individuals parts (the partial aggregate func (Consume) and the
final aggregate func (Finalize)) cannot be called from python individually.
So, for example, it is not possible to create a streaming aggregator in python.
However, in this case, you might be able to get away with something like
this:
```
import pyarrow as pa
import pyarrow.compute as pc
x = pa.chunked_array([[1, 2, 3, 4, 5], [6, 7, 8, 9]])
y = pa.chunked_array([[1, 1, 2, 2, 3], [4, 4]])
x_counts = pc.value_counts(x)
y_counts = pc.value_counts(y)
x_batch = pa.RecordBatch.from_struct_array(x_counts)
y_batch = pa.RecordBatch.from_struct_array(y_counts)
table = pa.Table.from_batches([x_batch, y_batch])
counts = table.group_by("values").aggregate([("counts", "sum")])
```
I'm not sure if it will be faster or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]