diff --git a/docs/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md b/docs/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md index 76f9bb1c0c66e..c3a9472f69193 100644 --- a/docs/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md +++ b/docs/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md @@ -44,18 +44,31 @@ ARRAYS_OVERLAP(, ) ## 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 | ++-----------------------------+ ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md index 96df976e2e8dd..1f448f6eca12e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/array-functions/arrays-overlap.md @@ -44,18 +44,33 @@ ARRAYS_OVERLAP(, ) ## 返回值 -返回判断结果: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 | ++-----------------------------+ ```