array_contains#

Description#

Tests if an array contains a value.

Returns true if array arr contains a value equal to val, where val is of variant type.

Returns false if the value is not contained. null is returned if either input parameter is null.

Note that this function considers null equal to null, and can therefore be used to check if an array contains null values.

Return type#

bool

Domain#

This is a scalar function (calculates a single output value for a single input row.)

Categories#

Usage#

array_contains(arr, val)

Argument

Type

Optional

Repeatable

Restrictions

arr

array

no

no

none

val

variant

no

no

none

Examples#

filter array_contains(names, "Bob")

Filter to include all rows whose names column (an array) contains the value Bob.

filter array_contains(phone_numbers, variant_null())

Filter to include rows where the phone_numbers column (an array) contains a null value.