array_contains

Description

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

Required

Multiple

arr

array

Required

Only one

val

variant

Required

Only one

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.