跳转至

Array cartesian product(数组笛卡尔积(Array cartesian product))

Supported in: Batch, Streaming

Compute the cartesian product of arrays.

Expression categories: Array

Declared arguments

  • Expression: Column to convert base.
    List\>>

Output type: Array\

Examples

Example 1: Base case

Argument values:

  • Expression: [first, second]
first second Output
[ [ {
s1: 1,
}, {
s1: 2,
} ], [ {
s1: 3,
} ] ]
[ [ {
s2: 4,
}, {
s2: 5,
} ], [ {
s2: 6,
} ] ]
[ {
first: [ {
s1: 1,
}, {
s1: 2,
} ],
 **secon...

Example 2: Base case

Argument values:

  • Expression: [first, second]
first second Output
[ 1, 2 ] [ 3, 4 ] [ {
first: 1,
second: 3,
}, {
first: 1,
 *second...

Example 3: Base case

Argument values:

  • Expression: [first, second, third]
first second third Output
[ 1, 2 ] [ word, a ] [ {
s1: 1,
}, {
s1: 2,
} ]
[ {
first: 1,
second: word,
third: {
s1: 1,
}...

Example 4: Null case

Argument values:

  • Expression: [first, second]
first second Output
[ 1, null ] [ null, 4 ] [ {
first: 1,
second: null,
}, {
first: 1,
 **se...
[ 1, 2 ] null [ ]
[ ] [ ] [ ]
null null [ ]


中文翻译


数组笛卡尔积(Array cartesian product)

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

计算数组的笛卡尔积。

表达式类别: 数组(Array)

声明的参数

  • 表达式(Expression): 待转换的基础列。
    List\>>

输出类型: Array\

示例

示例 1:基础情况

参数值:

  • 表达式: [first, second]
first second 输出(Output)
[ [ {
s1: 1,
}, {
s1: 2,
} ], [ {
s1: 3,
} ] ]
[ [ {
s2: 4,
}, {
s2: 5,
} ], [ {
s2: 6,
} ] ]
[ {
first: [ {
s1: 1,
}, {
s1: 2,
} ],
 **secon...

示例 2:基础情况

参数值:

  • 表达式: [first, second]
first second 输出(Output)
[ 1, 2 ] [ 3, 4 ] [ {
first: 1,
second: 3,
}, {
first: 1,
 **second*...

示例 3:基础情况

参数值:

  • 表达式: [first, second, third]
first second third 输出(Output)
[ 1, 2 ] [ word, a ] [ {
s1: 1,
}, {
s1: 2,
} ]
[ {
first: 1,
second: word,
third: {
s1: 1,
}...

示例 4:空值情况

参数值:

  • 表达式: [first, second]
first second 输出(Output)
[ 1, null ] [ null, 4 ] [ {
first: 1,
second: null,
}, {
first: 1,
 **se...
[ 1, 2 ] null [ ]
[ ] [ ] [ ]
null null [ ]