Array elements are distinct

Supported in: Batch, 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<Array<ComparableType>>

Output type: Boolean

Examples

Example 1: Base case

Argument values:

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

Example 2: Base case

Argument values:

  • Expression: part_ids
part_idsOutput
[ ]true

Example 3: Null case

Argument values:

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

Example 4: Null case

Argument values:

  • Expression: part_ids
part_idsOutput
nullfalse
[ ABC-123, EFG-123 ]true

Example 5: Edge case

Argument values:

  • Expression: part_ids
part_idsOutput
[ [ 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
addressOutput
[ {
city: New York,
street: Broadway,
}, {
city: New York,
street: Broadway,
} ]
false
[ {
city: New York,
street: Broadway,
}, {
city: Los Angeles,
street: Hoover Street,
} ]
true