> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ARRAYS_OVERLAP

> Tests whether arrays share an element.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL if either array is NULL. Two NULL elements count as a match.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
arrays_overlap(left, right)
```

## Arguments

Type notation used below:

* T is the array element type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY or STRUCT.

| Name | Type | Required | Description |
| - | - | - | - |
| left | ARRAY\<T> | Yes | First array. Nested elements/fields must satisfy the same element-type restrictions. |
| right | ARRAY\<T> | Yes | Second array. Nested elements/fields must satisfy the same element-type restrictions. |

## Returns

* Type: BOOLEAN
* Possible values: TRUE/FALSE.
* NULL behavior: Returns NULL if either array is NULL. Two NULL elements count as a match.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT arrays_overlap(ARRAY[1, 2], ARRAY[2, 3]) AS "value";
```

| value |
| - |
| true |

### NULL elements

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT arrays_overlap(ARRAY[CAST(NULL AS INT)],ARRAY[CAST(NULL AS INT)]) AS both_null, arrays_overlap(ARRAY[1,CAST(NULL AS INT)],ARRAY[2]) AS disjoint_with_null;
```

| both\_null | disjoint\_with\_null |
| - | - |
| true | false |

## Limitations

* Returns TRUE when both arrays contain NULL. Returns FALSE when they have no matching elements, even if one contains NULL. These NULL rules differ from Spark. Use ARRAYS\_OVERLAP; ARRAY\_HAS\_ANY is not an established alias.
* MAP elements, including MAP values nested inside compared elements, are outside the supported element types.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.