raw_to_partial#
- TopKUnique.raw_to_partial(block: pyarrow.Table | pandas.DataFrame) List[AccumulatorType] | pa.Array | pa.ChunkedArray | None#
Optional: turns every row of
blockinto its own accumulator.With
SHUFFLE_V2, a map task normally runsaggregate_blockon each group before shuffling. When the group keys are nearly unique, that pass shrinks nothing, so the map task can skip it and ship the rows as they are. The reducer then calls this method to turn those rows into accumulators and merges them withcombine. Implementing it lets aggregations skip that pass; seeDataContext.partial_aggregation_mode.- Parameters:
block (pyarrow.Table | pandas.DataFrame) – Raw rows: the group key columns and the column this aggregation reads (every column if
onisNone).- Returns:
the value
aggregate_blockwould return for a block holding only that row (Nonefor a row that contributes nothing, e.g. a null when nulls are ignored). A list, or an Arrow array for speed.None(the default) means the aggregation doesn’t support it, so map tasks always runaggregate_block.- Return type:
One accumulator per row, in row order