Skip to content

Commit f794c79

Browse files
authored
[Doc](function) fix arrays_overlap result (#2230)
apache/doris#49403 ## Versions - [x] dev - [ ] 3.0 - [ ] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English ## Docs Checklist - [ ] Checked by AI - [ ] Test Cases Built
1 parent e617ade commit f794c79

File tree

2 files changed

+48
-20
lines changed
  • docs/sql-manual/sql-functions/scalar-functions/array-functions
  • i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions

2 files changed

+48
-20
lines changed

docs/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,31 @@ ARRAYS_OVERLAP(<left>, <right>)
2424

2525
## Return Value
2626

27-
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
27+
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.
2828

2929
## Example
3030

31-
```sql
32-
SELECT ARRAYS_OVERLAP(['a', 'b', 'c'], [1, 2, 'b']);
3331
```
34-
35-
```text
36-
+--------------------------------------------------+
37-
| arrays_overlap(['a', 'b', 'c'], ['1', '2', 'b']) |
38-
+--------------------------------------------------+
39-
| 1 |
40-
+--------------------------------------------------+
32+
select arrays_overlap([1, 2, 3], [1, null]);
33+
+--------------------------------------+
34+
| arrays_overlap([1, 2, 3], [1, null]) |
35+
+--------------------------------------+
36+
| 1 |
37+
+--------------------------------------+
38+
39+
40+
select arrays_overlap([2, 3], [1, null]);
41+
+-----------------------------------+
42+
| arrays_overlap([2, 3], [1, null]) |
43+
+-----------------------------------+
44+
| NULL |
45+
+-----------------------------------+
46+
47+
select arrays_overlap([2, 3], [1]);
48+
+-----------------------------+
49+
+-----------------------------+
50+
| arrays_overlap([2, 3], [1]) |
51+
+-----------------------------+
52+
| 0 |
53+
+-----------------------------+
4154
```

i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,33 @@ ARRAYS_OVERLAP(<left>, <right>)
2424

2525
## 返回值
2626

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

2931
## 举例
3032

31-
```sql
32-
SELECT ARRAYS_OVERLAP(['a', 'b', 'c'], [1, 2, 'b']);
3333
```
34-
35-
```text
36-
+--------------------------------------------------+
37-
| arrays_overlap(['a', 'b', 'c'], ['1', '2', 'b']) |
38-
+--------------------------------------------------+
39-
| 1 |
40-
+--------------------------------------------------+
34+
select arrays_overlap([1, 2, 3], [1, null]);
35+
+--------------------------------------+
36+
| arrays_overlap([1, 2, 3], [1, null]) |
37+
+--------------------------------------+
38+
| 1 |
39+
+--------------------------------------+
40+
41+
42+
select arrays_overlap([2, 3], [1, null]);
43+
+-----------------------------------+
44+
| arrays_overlap([2, 3], [1, null]) |
45+
+-----------------------------------+
46+
| NULL |
47+
+-----------------------------------+
48+
49+
select arrays_overlap([2, 3], [1]);
50+
+-----------------------------+
51+
+-----------------------------+
52+
| arrays_overlap([2, 3], [1]) |
53+
+-----------------------------+
54+
| 0 |
55+
+-----------------------------+
4156
```

0 commit comments

Comments
 (0)