跳转至

Mode(众数(Mode))

Supported in: Batch, Faster

Calculate mode of values in column.

Expression categories: Aggregate

Declared arguments

  • Expression: The column of on which mode is computed.
    Expression\

Type variable bounds: Any accepts Binary | Boolean | Byte | Date | Decimal | Double | Float | Integer | Long | Short | String | Timestamp

Output type: Any

Examples

Example 1: Base case

Argument values:

  • Expression: values

Given input table:

values
a
b
b
b
c
c
d

Outputs: b


Example 2: Base case

Argument values:

  • Expression: values

Given input table:

values
1
1
2
2
2
2
4

Outputs: 2


Example 3: Null case

Argument values:

  • Expression: values

Given input table:

values

Outputs: null


Example 4: Null case

Argument values:

  • Expression: values

Given input table:

values
a
null
null
null
c
c
d

Outputs: c



中文翻译


众数(Mode)

支持模式:批处理(Batch)、快速(Faster)

计算列中数值的众数。

表达式类别: 聚合(Aggregate)

声明的参数

  • 表达式(Expression): 用于计算众数的列。
    表达式\<任意类型>

类型变量边界: 任意类型接受 Binary | Boolean | Byte | Date | Decimal | Double | Float | Integer | Long | Short | String | Timestamp

输出类型: 任意类型

示例

示例 1:基础情况

参数值:

  • 表达式: values

输入表:

values
a
b
b
b
c
c
d

输出结果: b


示例 2:基础情况

参数值:

  • 表达式: values

输入表:

values
1
1
2
2
2
2
4

输出结果: 2


示例 3:空值情况

参数值:

  • 表达式: values

输入表:

values

输出结果: null


示例 4:空值情况

参数值:

  • 表达式: values

输入表:

values
a
null
null
null
c
c
d

输出结果: c