跳转至

Explode map(展开映射 (Explode map))

Supported in: Batch, Streaming

Explode map into a row per key, value pair.

Expression categories: Map

Declared arguments

  • Expression: The map to explode.
    Expression\>

Type variable bounds: TKey accepts AnyType**TValue accepts AnyType

Output type: Struct\

Examples

Example 1: Base case

Argument values:

  • Expression: map

Given input table:

map
{
 1 -> val1,
 2 -> val2,
}
{
 3 -> val3,
 4 -> val4,
}

Expected output table: | map | | ----- | | {
 key -> 1,
 value -> val1,
} | | {
 key -> 2,
 value -> val2,
} | | {
 key -> 3,
 value -> val3,
} | | {
 key -> 4,
 value -> val4,
} |


Example 2: Edge case

Argument values:

  • Expression: map

Given input table:

map
{
 k1 -> q1,
}
{

}

Expected output table: | map | | ----- | | {
 key -> k1,
 value -> q1,
} |


Example 3: Edge case

Argument values:

  • Expression: map

Given input table:

map
null

Expected output table: | map | | ----- |



中文翻译


展开映射 (Explode map)

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

将映射展开为每行一个键值对。

表达式类别: 映射 (Map)

声明的参数

  • 表达式 (Expression): 要展开的映射。
    表达式\<映射\>

类型变量约束: TKey 接受任意类型 (AnyType)**TValue 接受任意类型 (AnyType)

输出类型: 结构体\<可选[键]:TKey, 可选[值]:TValue>

示例

示例 1:基础情况

参数值:

  • 表达式: map

给定输入表:

map
{
 1 -> val1,
 2 -> val2,
}
{
 3 -> val3,
 4 -> val4,
}

预期输出表: | map | | ----- | | {
 key -> 1,
 value -> val1,
} | | {
 key -> 2,
 value -> val2,
} | | {
 key -> 3,
 value -> val3,
} | | {
 key -> 4,
 value -> val4,
} |


示例 2:边界情况

参数值:

  • 表达式: map

给定输入表:

map
{
 k1 -> q1,
}
{

}

预期输出表: | map | | ----- | | {
 key -> k1,
 value -> q1,
} |


示例 3:边界情况

参数值:

  • 表达式: map

给定输入表:

map
null

预期输出表: | map | | ----- |