arrays_overlap¶
Description¶
Compares whether two arrays have at least one element in common.
Returns true if there is at least one element in common; otherwise returns false.
The function is NULL-safe, meaning if both arrays contain a null element, it is considered to be an overlapping element and arrays_overlap()
will return true.
Return type¶
bool
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
arrays_overlap(input_array_1, input_array_2)
Argument |
Type |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
input_array_1 |
array |
no |
no |
none |
input_array_2 |
array |
no |
no |
none |
Examples¶
make_col foo:arrays_overlap(make_array('hello', 'goodbye'), make_array('katze', 'hund'))
Make the column ‘foo’ with a False
as the input arrays have no overlap.
filter arrays_overlap(names, places)
Filter to include all rows whose names
column (an array) overlaps with the places
column (another array).
make_col foo:arrays_overlap(make_array('hello', variant_null()), make_array('katze', variant_null()))
Make the column ‘foo’ with a True
as the input arrays overlap on the null
value.