Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,31 @@ ARRAYS_OVERLAP(<left>, <right>)

## Return Value

Returns the judgment result: 1: left and right arrays have common elements; 0: left and right arrays do not have common elements; NULL: left or right array is NULL; or any element in left and right array is NULL
Returns if left and right have any non-null elements in common. Returns null if there are no non-null elements in common but either array contains null.

## Example

```sql
SELECT ARRAYS_OVERLAP(['a', 'b', 'c'], [1, 2, 'b']);
```
select arrays_overlap([1, 2, 3], [1, null]);
+--------------------------------------+
| arrays_overlap([1, 2, 3], [1, null]) |
+--------------------------------------+
| 1 |
+--------------------------------------+


select arrays_overlap([2, 3], [1, null]);
+-----------------------------------+
| arrays_overlap([2, 3], [1, null]) |
+-----------------------------------+
| NULL |
+-----------------------------------+

```text
+--------------------------------------------------+
| arrays_overlap(['a', 'b', 'c'], ['1', '2', 'b']) |
+--------------------------------------------------+
| 1 |
+--------------------------------------------------+
select arrays_overlap([2, 3], [1]);
+-----------------------------+
+-----------------------------+
| arrays_overlap([2, 3], [1]) |
+-----------------------------+
| 0 |
+-----------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,33 @@ ARRAYS_OVERLAP(<left>, <right>)

## 返回值

返回判断结果:1:left 和 right 数组存在公共元素;0:left 和 right 数组不存在公共元素;NULL:left 或者 right 数组为 NULL;或者 left 和 right 数组中,任意元素为 NULL
如果 left 和 right 具有任何非 null 的共同元素,则返回 true。
如果没有非 null 的共同元素且任一数组包含 null,则返回 null。
如果没有非 null 的共同元素,且 left 和 right 都不包含 null,则返回 false。

## 举例

```sql
SELECT ARRAYS_OVERLAP(['a', 'b', 'c'], [1, 2, 'b']);
```
select arrays_overlap([1, 2, 3], [1, null]);
+--------------------------------------+
| arrays_overlap([1, 2, 3], [1, null]) |
+--------------------------------------+
| 1 |
+--------------------------------------+


select arrays_overlap([2, 3], [1, null]);
+-----------------------------------+
| arrays_overlap([2, 3], [1, null]) |
+-----------------------------------+
| NULL |
+-----------------------------------+

```text
+--------------------------------------------------+
| arrays_overlap(['a', 'b', 'c'], ['1', '2', 'b']) |
+--------------------------------------------------+
| 1 |
+--------------------------------------------------+
select arrays_overlap([2, 3], [1]);
+-----------------------------+
+-----------------------------+
| arrays_overlap([2, 3], [1]) |
+-----------------------------+
| 0 |
+-----------------------------+
```
Loading