跳转至

Explode array(展开数组(Explode array))

Supported in: Batch, Faster, Streaming

Explode array into a row per value.

Expression categories: Array

Declared arguments

  • Expression: The array to explode.
    Expression\>
  • optional Keep empty / null arrays: If true, empty arrays and nulls will be kept as nulls in the output, otherwise they will be filtered.
    Literal\

Type variable bounds: T accepts AnyType

Output type: T

Examples

Example 1: Base case

Argument values:

  • Expression: array
  • Keep empty / null arrays: false

Given input table:

array
[ 1, 2 ]

Expected output table: | array | | ----- | | 1 | | 2 |


Example 2: Base case

Argument values:

  • Expression: array
  • Keep empty / null arrays: false

Given input table:

array
[ 1, 2 ]
[ ]

Expected output table: | array | | ----- | | 1 | | 2 |


Example 3: Base case

Argument values:

  • Expression: array
  • Keep empty / null arrays: true

Given input table:

array
[ 1, 2 ]
[ ]

Expected output table: | array | | ----- | | 1 | | 2 | | null |


Example 4: Base case

Argument values:

  • Expression: array
  • Keep empty / null arrays: true

Given input table:

array
[ 1, 2 ]
[ null ]

Expected output table: | array | | ----- | | 1 | | 2 | | null |



中文翻译

展开数组(Explode array)

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

将数组展开为每行一个值。

表达式类别: 数组(Array)

声明的参数

  • 表达式(Expression): 要展开的数组。
    表达式\<数组\>
  • 可选 保留空/空值数组(Keep empty / null arrays): 如果为true,空数组和空值将在输出中保留为空值,否则将被过滤掉。
    字面量\<布尔值>

类型变量边界: T 接受任意类型(AnyType)

输出类型: T

示例

示例1:基本情况

参数值:

  • 表达式(Expression): array
  • 保留空/空值数组(Keep empty / null arrays): false

给定输入表:

array
[ 1, 2 ]

预期输出表: | array | | ----- | | 1 | | 2 |


示例2:基本情况

参数值:

  • 表达式(Expression): array
  • 保留空/空值数组(Keep empty / null arrays): false

给定输入表:

array
[ 1, 2 ]
[ ]

预期输出表: | array | | ----- | | 1 | | 2 |


示例3:基本情况

参数值:

  • 表达式(Expression): array
  • 保留空/空值数组(Keep empty / null arrays): true

给定输入表:

array
[ 1, 2 ]
[ ]

预期输出表: | array | | ----- | | 1 | | 2 | | null |


示例4:基本情况

参数值:

  • 表达式(Expression): array
  • 保留空/空值数组(Keep empty / null arrays): true

给定输入表:

array
[ 1, 2 ]
[ null ]

预期输出表: | array | | ----- | | 1 | | 2 | | null |