跳转至

Array difference(数组差集(Array difference))

Supported in: Batch, Faster, Streaming

Returns all unique elements in the left array that are not in the right array.

Expression categories: Array

Declared arguments

  • Left array: no description
    Expression\>
  • Right array: no description
    Expression\>

Type variable bounds: T accepts AnyType

Output type: Array\

Examples

Example 1: Base case

Argument values:

  • Left array: [ 1, 2, 3 ]
  • Right array: [ 2, 3, 4 ]

Output: [ 1 ]


Example 2: Null case

Argument values:

  • Left array: first_array
  • Right array: second_array
first_array second_array Output
[ 1, 2, 3 ] null [ 1, 2, 3 ]
null [ 1, 2, 3 ] null
null null null

Example 3: Edge case

Description: Duplicates in the left array will be removed.

Argument values:

  • Left array: [ 1, 1, 2, 3 ]
  • Right array: [ 2, 3, 4 ]

Output: [ 1 ]



中文翻译

数组差集(Array difference)

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

返回数组中所有不在数组中的唯一元素。

表达式类别: 数组(Array)

声明参数

  • 左数组(Left array): 无描述
    表达式\<数组\>
  • 右数组(Right array): 无描述
    表达式\<数组\>

类型变量约束: T 接受任意类型(AnyType)

输出类型: 数组\

示例

示例1:基础情况

参数值:

  • 左数组: [ 1, 2, 3 ]
  • 右数组: [ 2, 3, 4 ]

输出: [ 1 ]


示例2:空值情况

参数值:

  • 左数组: first_array
  • 右数组: second_array
first_array second_array 输出(Output)
[ 1, 2, 3 ] null [ 1, 2, 3 ]
null [ 1, 2, 3 ] null
null null null

示例3:边界情况

描述: 左数组中的重复元素将被移除。

参数值:

  • 左数组: [ 1, 1, 2, 3 ]
  • 右数组: [ 2, 3, 4 ]

输出: [ 1 ]