跳转至

Array elements are distinct(数组元素互异性(Array elements are distinct))

Supported in: Batch, Faster, Streaming

Returns true if the array's elements are distinct, false otherwise. If the array is null, the returned value is false.

Expression categories: Array, Boolean

Declared arguments

  • Expression: An array that could contain duplicate elements.
    Expression\>

Output type: Boolean

Examples

Example 1: Base case

Argument values:

  • Expression: part_ids
part_ids Output
[ ABC-123, DCE-123, EFG-123 ] true
[ ABC-123, ABC-123, EFG-123 ] false

Example 2: Base case

Argument values:

  • Expression: part_ids
part_ids Output
[ ] true

Example 3: Null case

Argument values:

  • Expression: part_ids
part_ids Output
[ ABC-123, null ] true
[ ABC-123, null, ABC-123 ] false
[ null, null ] false

Example 4: Null case

Argument values:

  • Expression: part_ids
part_ids Output
null false
[ ABC-123, EFG-123 ] true

Example 5: Edge case

Argument values:

  • Expression: part_ids
part_ids Output
[ [ ABC-123, EFG-123 ], [ ABC-123, EFG-123 ] ] false
[ [ ABC-123, EFG-123 ], [ ABC-123, XYZ-123 ] ] true
[ [ ABC-123, EFG-123 ], [ EFG-123, ABC-123 ] ] true

Example 6: Edge case

Argument values:

  • Expression: address
address Output
[ {
city: New York,
street: Broadway,
}, {
city: New York,
street: Broadway,
} ]
false
[ {
city: New York,
street: Broadway,
}, {
city: Los Angeles,
street: Hoover Street,
} ]
true


中文翻译

数组元素互异性(Array elements are distinct)

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

如果数组中的元素互不相同则返回 true,否则返回 false。如果数组为 null,则返回 false。

表达式类别: 数组(Array)、布尔(Boolean)

声明的参数

  • 表达式(Expression): 可能包含重复元素的数组。
    Expression\>

输出类型: Boolean

示例

示例 1:基础情况

参数值:

  • 表达式(Expression): part_ids
part_ids 输出(Output)
[ ABC-123, DCE-123, EFG-123 ] true
[ ABC-123, ABC-123, EFG-123 ] false

示例 2:基础情况

参数值:

  • 表达式(Expression): part_ids
part_ids 输出(Output)
[ ] true

示例 3:空值情况

参数值:

  • 表达式(Expression): part_ids
part_ids 输出(Output)
[ ABC-123, null ] true
[ ABC-123, null, ABC-123 ] false
[ null, null ] false

示例 4:空值情况

参数值:

  • 表达式(Expression): part_ids
part_ids 输出(Output)
null false
[ ABC-123, EFG-123 ] true

示例 5:边界情况

参数值:

  • 表达式(Expression): part_ids
part_ids 输出(Output)
[ [ ABC-123, EFG-123 ], [ ABC-123, EFG-123 ] ] false
[ [ ABC-123, EFG-123 ], [ ABC-123, XYZ-123 ] ] true
[ [ ABC-123, EFG-123 ], [ EFG-123, ABC-123 ] ] true

示例 6:边界情况

参数值:

  • 表达式(Expression): address
address 输出(Output)
[ {
city: New York,
street: Broadway,
}, {
city: New York,
street: Broadway,
} ]
false
[ {
city: New York,
street: Broadway,
}, {
city: Los Angeles,
street: Hoover Street,
} ]
true