跳转至

Min by

Supported in: Streaming

This expression computes a min row according to the min column expression after applying the provided filter specification. If there is no minimum row, null will be returned.

Expression categories: Aggregate

Declared arguments

  • Expression: Column expression on which the min is computed. Null values are treated as if they have the largest value.
    Expression\
  • Output projection expression: Defines the projection expression that is applied on the minimum row before it is returned.
    Expression\
  • optional Filter condition: This parameter defines the filter specification that is applied on the rows contained within the window. The output of this expression will only reference rows which are not filtered by this parameter (i.e., where the condition evaluates to true). If no rows exist in state at the time of a trigger, null will be emitted.
    Expression\

Output type: AnyType

Examples

Example 1: Base case

Argument values:

  • Expression: salary
  • Output projection expression: salary
  • Filter condition:
    greaterThan(
     left: salary,
     right: 0,
    )

Given input table:

dep_name salary
develop -999
develop 4000
develop 3000

Outputs: 3000


Example 2: Base case

Argument values:

  • Expression: salary
  • Output projection expression: salary
  • Filter condition: null

Given input table:

dep_name salary
develop 4000
develop null
develop 1000

Outputs: 1000



中文翻译


Min by

支持:流式处理(Streaming)

该表达式在应用指定的过滤条件后,根据最小值列表达式(Min column expression)计算最小值行。若不存在最小值行,则返回空值。

表达式类别: 聚合(Aggregate)

声明的参数

  • 表达式(Expression): 用于计算最小值的列表达式。空值被视为具有最大值。
    表达式\<可比较类型>
  • 输出投影表达式(Output projection expression): 定义在返回最小值行之前对其应用的投影表达式。
    表达式\<任意类型>
  • 可选 过滤条件(Filter condition): 此参数定义应用于窗口内行的过滤规范。该表达式的输出仅引用未被此参数过滤的行(即条件评估为真的行)。若在触发时状态中不存在任何行,则将输出空值。
    表达式\<布尔类型>

输出类型: 任意类型

示例

示例 1:基础情况

参数值:

  • 表达式: salary
  • 输出投影表达式: salary
  • 过滤条件:
    greaterThan(
     left: salary,
     right: 0,
    )

给定输入表:

dep_name salary
develop -999
develop 4000
develop 3000

输出结果: 3000


示例 2:基础情况

参数值:

  • 表达式: salary
  • 输出投影表达式: salary
  • 过滤条件: 空值

给定输入表:

dep_name salary
develop 4000
develop 空值
develop 1000

输出结果: 1000