跳转至

Aggregate(聚合(Aggregate))

Supported in: Batch, Faster

Performs the specified aggregations on the input dataset grouped by a set of columns.

Transform categories: Aggregate, Popular

Declared arguments

  • Aggregations: List of aggregations to perform on the dataset.
    List\>
  • Dataset: Dataset to perform aggregate on.
    Table
  • optional Group by columns: List of columns to group the dataset by when aggregating. If empty, no group by is applied.
    List\>

Examples

Example 1: Base case

Argument values:

  • Aggregations: [
    alias(
     alias: factor,
     expression:
    sum(
     expression: factor,
    ),
    )]
  • Dataset: ri.foundry.main.dataset.aggregate
  • Group by columns: [tail_number]

Input:

tail_number airline miles factor
XB-123 foundry air 124 2
MT-222 new airline 1123 5
XB-123 foundry airline 335 5
MT-222 new air 565 4
KK-452 new air 222 1
XB-123 foundry airline 1134 3

Output:

tail_number factor
XB-123 10
MT-222 9
KK-452 1


中文翻译


聚合(Aggregate)

支持运行环境:批处理(Batch)、快速处理(Faster)

根据一组列对输入数据集进行分组,并执行指定的聚合操作。

转换类别:聚合(Aggregate)、常用(Popular)

声明参数

  • 聚合操作(Aggregations): 对数据集执行的聚合操作列表。
    列表\<表达式\<任意类型>>
  • 数据集(Dataset): 需要执行聚合操作的数据集。
    表(Table)
  • 可选 分组列(Group by columns): 聚合时用于对数据集进行分组的列列表。若为空,则不应用分组。
    列表\<列\<任意类型>>

示例

示例 1:基础案例

参数值:

  • 聚合操作(Aggregations): [
    别名(
     别名: factor,
     表达式:
    求和(
     表达式: factor,
    ),
    )]
  • 数据集(Dataset): ri.foundry.main.dataset.aggregate
  • 分组列(Group by columns): [tail_number]

输入:

tail_number airline miles factor
XB-123 foundry air 124 2
MT-222 new airline 1123 5
XB-123 foundry airline 335 5
MT-222 new air 565 4
KK-452 new air 222 1
XB-123 foundry airline 1134 3

输出:

tail_number factor
XB-123 10
MT-222 9
KK-452 1