跳转至

First(First(首个))

Supported in: Batch, Faster, Streaming

First item in the group. Note, if used within an aggregate or unordered window, the row selected will be non-deterministic.

Expression categories: Aggregate

Declared arguments

  • Expression: Expression to aggregate.
    Expression\
  • Ignore nulls: If true, null values will be ignored.
    Literal\

Type variable bounds: T accepts AnyType

Output type: T

Examples

Example 1: Base case

Argument values:

  • Expression: values
  • Ignore nulls: false

Given input table:

values
null
2
4
3

Outputs: null


Example 2: Base case

Argument values:

  • Expression: values
  • Ignore nulls: true

Given input table:

values
null
2
4
3

Outputs: 2



中文翻译


First(首个)

支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)

分组中的首个条目。注意,如果在聚合窗口(aggregate)或无序窗口(unordered window)中使用,所选行将具有非确定性。

表达式类别: 聚合(Aggregate)

声明的参数

  • 表达式(Expression): 要聚合的表达式。
    Expression\
  • 忽略空值(Ignore nulls): 若为 true,将忽略空值。
    Literal\

类型变量边界: T 接受 AnyType

输出类型: T

示例

示例 1:基础情况

参数值:

  • 表达式: values
  • 忽略空值: false

给定输入表:

values
null
2
4
3

输出结果: null


示例 2:基础情况

参数值:

  • 表达式: values
  • 忽略空值: true

给定输入表:

values
null
2
4
3

输出结果: 2