Array contains

Supported in: Batch, Streaming

Returns true if the array contains the value.

Expression categories: Array, Boolean

Declared arguments

  • Array - The array to search within.
    Expression<Array<ComparableType>>
  • Value - The value to search for within the array.
    Expression<ComparableType>

Output type: Boolean

Examples

Example 1: Base case

Argument values:

  • Array: part_ids
  • Value: BRR-123
part_idsOutput
[ AWE-112, BRR-123 ]true
[ AWE-222, ABC-543 ]false

Example 2: Base case

Description: Comparisons between different numeric types is allowed. Argument values:

  • Array: ids
  • Value: 1
idsOutput
[ 1, 2 ]true
[ 2, 3 ]false

Example 3: Null case

Argument values:

  • Array: array
  • Value: value
arrayvalueOutput
[ 1, 2, 3 ]nullfalse
null1false
nullnullfalse
[ 1, 2, 3, null ]nulltrue