docstr: Partition the block and combine rows with the same key.
docstr_tok: ["Partition","the","block","and","combine","rows","with","the","same","key","."]
code: def map(
      idx: int,
      block: Block,
      output_num_blocks: int,
      boundaries: List[KeyType],
      key: str,
      aggs: Tuple[AggregateFn],
  ) -> List[Union[BlockMetadata, Block]]:
      """Partition the block and combine rows with the same key."""
      stats = BlockExecStats.builder()
  
      block = _GroupbyOp._prune_unused_columns(block, key, aggs)
  
      if key is None:
          partitions = [block]
      else:
          partitions = BlockAccessor.for_block(
              block
          ).sort_and_partition(
              boundaries,
              SortKey(key),
          )
      parts = [
          BlockAccessor.for_block(p).combine(key, aggs)
          for p in partitions
      ]
      meta = BlockAccessor.for_block(block).get_metadata(
          input_files=None, exec_stats=stats.build()
      )
      return parts + [meta]
  
imports: from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  from ._internal.table_block import TableBlockAccessor
  from ray.data._internal import sort
  from ray.data._internal.compute import ComputeStrategy
  from ray.data._internal.delegating_block_builder import DelegatingBlockBuilder
  from ray.data._internal.execution.interfaces import TaskContext
  from ray.data._internal.logical.interfaces import LogicalPlan
  from ray.data._internal.logical.operators.all_to_all_operator import Aggregate
  from ray.data._internal.plan import AllToAllStage
  from ray.data._internal.push_based_shuffle import PushBasedShufflePlan
  from ray.data._internal.shuffle import ShuffleOp, SimpleShufflePlan
  from ray.data._internal.sort import SortKey
  from ray.data.aggregate import AggregateFn, Count, Max, Mean, Min, Std, Sum
  from ray.data.aggregate._aggregate import _AggregateOnKeyBase
  from ray.data.block import Block, BlockAccessor, BlockExecStats, BlockMetadata, KeyType, UserDefinedFunction
  from ray.data.context import DataContext
  from ray.data.dataset import DataBatch, Dataset
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 1 for calling the _GroupbyOp obj's underlying member method code with example usage: obj.map(idx, block, output_num_blocks, boundaries, key, aggs) and returns: unknown