This is an automated email from the ASF dual-hosted git repository.
HappenLee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 045f6ea58ee [fix](docs) Correct NULL behavior for vector distance
functions (#3986)
045f6ea58ee is described below
commit 045f6ea58ee8ae382eb058c8a2a68d049a7f6599
Author: HappenLee <[email protected]>
AuthorDate: Wed Jul 15 22:14:52 2026 +0800
[fix](docs) Correct NULL behavior for vector distance functions (#3986)
- Correct the documented NULL behavior of `l1_distance`, `l2_distance`,
`cosine_distance`, `inner_product`, `l2_distance_approximate`, and
`inner_product_approximate`.
- Clarify that a NULL array or a NULL array element raises an
`INVALID_ARGUMENT` error instead of returning NULL, and add examples for
both cases.
- Keep the current and 4.x English and Chinese pages synchronized. The
behavior change was introduced in Doris PR #55631 and is not present in
3.x, so older versioned docs remain unchanged.
## Validation
- `git diff --check`
- `npm run docs:links:changed` (0 findings)
- `npm run docs:i18n-sync:changed` (Japanese candidate-translation
notices only)
- `npm run docs:sql-functions:changed` (existing structural warnings in
the touched legacy pages; no errors)
- `npx docusaurus build` compiled the documentation and then hit the
repository's existing `build/blog.html/index.html` redirect collision
during post-build.
## Versions
- [x] dev
- [x] 4.x
- [ ] 3.x
- [ ] 2.1 or older (not covered by version/language sync gate)
## Languages
- [x] Chinese
- [x] English
- [x] Japanese candidate translation needed
## Docs Checklist
- [x] Checked by AI
- [ ] Test Cases Built (documentation-only change; the behavior is
covered by Doris regression tests)
- [x] Updated required version and language counterparts, or explained
why not
- [x] If only one language changed, confirmed whether source/translation
counterparts need sync (not applicable; both English and Chinese were
updated)
---
.../distance-functions/cosine-distance.md | 24 +++++++++++++++++++-
.../inner-product-approximate.md | 24 +++++++++++++++++++-
.../distance-functions/inner-product.md | 24 +++++++++++++++++++-
.../ai-functions/distance-functions/l1-distance.md | 24 +++++++++++++++++++-
.../distance-functions/l2-distance-approximate.md | 24 +++++++++++++++++++-
.../ai-functions/distance-functions/l2-distance.md | 24 +++++++++++++++++++-
.../distance-functions/cosine-distance.md | 24 +++++++++++++++++++-
.../inner-product-approximate.md | 26 ++++++++++++++++++++--
.../distance-functions/inner-product.md | 24 +++++++++++++++++++-
.../ai-functions/distance-functions/l1-distance.md | 24 +++++++++++++++++++-
.../distance-functions/l2-distance-approximate.md | 26 ++++++++++++++++++++--
.../ai-functions/distance-functions/l2-distance.md | 24 +++++++++++++++++++-
.../distance-functions/cosine-distance.md | 24 +++++++++++++++++++-
.../inner-product-approximate.md | 26 ++++++++++++++++++++--
.../distance-functions/inner-product.md | 24 +++++++++++++++++++-
.../ai-functions/distance-functions/l1-distance.md | 24 +++++++++++++++++++-
.../distance-functions/l2-distance-approximate.md | 26 ++++++++++++++++++++--
.../ai-functions/distance-functions/l2-distance.md | 24 +++++++++++++++++++-
.../distance-functions/cosine-distance.md | 24 +++++++++++++++++++-
.../inner-product-approximate.md | 24 +++++++++++++++++++-
.../distance-functions/inner-product.md | 24 +++++++++++++++++++-
.../ai-functions/distance-functions/l1-distance.md | 24 +++++++++++++++++++-
.../distance-functions/l2-distance-approximate.md | 24 +++++++++++++++++++-
.../ai-functions/distance-functions/l2-distance.md | 24 +++++++++++++++++++-
24 files changed, 556 insertions(+), 28 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
index 316bfd72c6f..049ee1a2508 100644
---
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
+++
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
@@ -25,7 +25,9 @@ COSINE_DISTANCE(<array1>, <array2>)
## Return Value
-Returns the cosine distance between two vectors (where the vector values are
coordinates). If the input array is NULL, or any element in the array is NULL,
then NULL is returned.
+Returns the cosine distance between two vectors (where the vector values are
coordinates). The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -40,3 +42,23 @@ SELECT COSINE_DISTANCE([1, 2], [2, 3]),COSINE_DISTANCE([3,
6], [4, 7]);
| 0.007722139 | 0.001539648 |
+---------------------------------+---------------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT COSINE_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT COSINE_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
have null
+```
diff --git
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
index df889406d07..9e643f8d2b5 100644
---
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
+++
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
@@ -25,7 +25,9 @@ INNER_PRODUCT_APPROXIMATE(<array1>, <array2>)
## Return Value
-Returns the scalar product of two vectors of the same size. If the input array
is NULL, or any element in array is NULL, then NULL is returned.
+Returns the scalar product of two vectors of the same size. The return type is
`FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Examples
@@ -85,3 +87,23 @@ Result
+--------+----------+
10 rows in set (0.04 sec)
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot have null
+```
diff --git
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
index 1036da01320..c64ca9ea074 100644
---
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
+++
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
@@ -25,7 +25,9 @@ INNER_PRODUCT(<array1>, <array2>)
## Return Value
-Returns the scalar product of two vectors of the same size. If the input array
is NULL, or any element in array is NULL, then NULL is returned.
+Returns the scalar product of two vectors of the same size. The return type is
`FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Examples
@@ -40,3 +42,23 @@ SELECT INNER_PRODUCT([1, 2], [2, 3]),INNER_PRODUCT([3, 6],
[4, 7]);
| 8 | 54 |
+-------------------------------+-------------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
have null
+```
diff --git
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
index 924350fe39b..46b51830371 100644
---
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
+++
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
@@ -25,7 +25,9 @@ L1_DISTANCE(<array1>, <array2>)
## Return Value
-Returns the distance between two points (vector values are coordinates) in L1
space. If the input array is NULL, or any element in the array is NULL, then
NULL is returned.
+Returns the distance between two points (vector values are coordinates) in L1
space. The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -40,3 +42,23 @@ SELECT L1_DISTANCE([4, 5], [6, 8]),L1_DISTANCE([3, 6], [4,
5]);
| 5 | 2 |
+-----------------------------+-----------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT L1_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot be
null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT L1_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot
have null
+```
diff --git
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
index 878dfff6137..bc7fd6dab63 100644
---
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
+++
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
@@ -25,7 +25,9 @@ L2_DISTANCE_APPROXIMATE(<array1>, <array2>)
## Return Value
-Returns the distance between two points (vector values are coordinates) in
Euclidean space. If the input array is NULL, or any element in the array is
NULL, then NULL is returned.
+Returns the distance between two points (vector values are coordinates) in
Euclidean space. The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -85,3 +87,23 @@ Result
+--------+----------+
10 rows in set (0.08 sec)
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot have null
+```
diff --git
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
index 917f8ef883e..9e61fdeb124 100644
---
a/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
+++
b/docs/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
@@ -25,7 +25,9 @@ L2_DISTANCE(<array1>, <array2>)
## Return Value
-Returns the distance between two points (vector values are coordinates) in
Euclidean space. If the input array is NULL, or any element in the array is
NULL, then NULL is returned.
+Returns the distance between two points (vector values are coordinates) in
Euclidean space. The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -40,3 +42,23 @@ SELECT L2_DISTANCE([4, 5], [6, 8]),L2_DISTANCE([3, 6], [4,
5]);
| 3.605551 | 1.414214 |
+-----------------------------+-----------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot be
null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
index 9f5c80d0c51..ab49c5b4a5d 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
@@ -25,7 +25,9 @@ COSINE_DISTANCE(<array1>, <array2>)
## 返回值
-返回两个向量(向量值为坐标)之间的余弦距离。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回两个向量(向量值为坐标)之间的余弦距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT COSINE_DISTANCE([1, 2], [2, 3]),COSINE_DISTANCE([3,
6], [4, 7]);
| 0.007722139 | 0.001539648 |
+---------------------------------+---------------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT COSINE_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT COSINE_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
index 98d68848565..c8ce584b908 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
@@ -25,7 +25,9 @@ INNER_PRODUCT_APPROXIMATE(<array1>, <array2>)
## 返回值
-返回两个相同大小向量的标量积。如果输入数组为 NULL,或数组中的任一元素为 NULL,则返回 NULL。
+返回两个相同大小向量的标量积,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 示例
@@ -84,4 +86,24 @@ LIMIT 10
| 153488 | 231871 |
+--------+----------+
10 rows in set (0.04 sec)
-```
\ No newline at end of file
+```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
index c95108fc447..c0defe3deeb 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
@@ -25,7 +25,9 @@ INNER_PRODUCT(<array1>, <array2>)
## 返回值
-返回两个大小相同的向量的标量积。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回两个大小相同的向量的标量积,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT INNER_PRODUCT([1, 2], [2, 3]),INNER_PRODUCT([3, 6],
[4, 7]);
| 8 | 54 |
+-------------------------------+-------------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
index 927fd23b6de..58017238579 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
@@ -25,7 +25,9 @@ L1_DISTANCE(<array1>, <array2>)
## 返回值
-返回 L1 空间中两点(向量值为坐标)之间的距离。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回 L1 空间中两点(向量值为坐标)之间的距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT L1_DISTANCE([4, 5], [6, 8]),L1_DISTANCE([3, 6], [4,
5]);
| 5 | 2 |
+-----------------------------+-----------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT L1_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot be
null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT L1_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
index baa5f6b550a..2dff74f9d57 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
@@ -25,7 +25,9 @@ L2_DISTANCE_APPROXIMATE(<array1>, <array2>)
## 返回值
-返回欧氏空间中两个点(向量值为坐标)之间的距离。如果输入数组为 NULL,或数组中的任一元素为 NULL,则返回 NULL。
+返回欧氏空间中两个点(向量值为坐标)之间的距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 示例
@@ -84,4 +86,24 @@ LIMIT 10
| 866737 | 231.6441 |
+--------+----------+
10 rows in set (0.08 sec)
-```
\ No newline at end of file
+```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
index bf878782e46..3285a1ddb24 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
@@ -25,7 +25,9 @@ L2_DISTANCE(<array1>, <array2>)
## 返回值
-返回欧几里得空间中两点(向量值为坐标)之间的距离。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回欧几里得空间中两点(向量值为坐标)之间的距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT L2_DISTANCE([4, 5], [6, 8]),L2_DISTANCE([3, 6], [4,
5]);
| 3.605551 | 1.414214 |
+-----------------------------+-----------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT L2_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot be
null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT L2_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
index 9f5c80d0c51..ab49c5b4a5d 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
@@ -25,7 +25,9 @@ COSINE_DISTANCE(<array1>, <array2>)
## 返回值
-返回两个向量(向量值为坐标)之间的余弦距离。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回两个向量(向量值为坐标)之间的余弦距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT COSINE_DISTANCE([1, 2], [2, 3]),COSINE_DISTANCE([3,
6], [4, 7]);
| 0.007722139 | 0.001539648 |
+---------------------------------+---------------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT COSINE_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT COSINE_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
index 98d68848565..c8ce584b908 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
@@ -25,7 +25,9 @@ INNER_PRODUCT_APPROXIMATE(<array1>, <array2>)
## 返回值
-返回两个相同大小向量的标量积。如果输入数组为 NULL,或数组中的任一元素为 NULL,则返回 NULL。
+返回两个相同大小向量的标量积,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 示例
@@ -84,4 +86,24 @@ LIMIT 10
| 153488 | 231871 |
+--------+----------+
10 rows in set (0.04 sec)
-```
\ No newline at end of file
+```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
index c95108fc447..c0defe3deeb 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
@@ -25,7 +25,9 @@ INNER_PRODUCT(<array1>, <array2>)
## 返回值
-返回两个大小相同的向量的标量积。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回两个大小相同的向量的标量积,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT INNER_PRODUCT([1, 2], [2, 3]),INNER_PRODUCT([3, 6],
[4, 7]);
| 8 | 54 |
+-------------------------------+-------------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT INNER_PRODUCT([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
index 927fd23b6de..58017238579 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
@@ -25,7 +25,9 @@ L1_DISTANCE(<array1>, <array2>)
## 返回值
-返回 L1 空间中两点(向量值为坐标)之间的距离。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回 L1 空间中两点(向量值为坐标)之间的距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT L1_DISTANCE([4, 5], [6, 8]),L1_DISTANCE([3, 6], [4,
5]);
| 5 | 2 |
+-----------------------------+-----------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT L1_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot be
null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT L1_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot
have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
index baa5f6b550a..2dff74f9d57 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
@@ -25,7 +25,9 @@ L2_DISTANCE_APPROXIMATE(<array1>, <array2>)
## 返回值
-返回欧氏空间中两个点(向量值为坐标)之间的距离。如果输入数组为 NULL,或数组中的任一元素为 NULL,则返回 NULL。
+返回欧氏空间中两个点(向量值为坐标)之间的距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 示例
@@ -84,4 +86,24 @@ LIMIT 10
| 866737 | 231.6441 |
+--------+----------+
10 rows in set (0.08 sec)
-```
\ No newline at end of file
+```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot be null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot have null
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
index bf878782e46..3285a1ddb24 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
@@ -25,7 +25,9 @@ L2_DISTANCE(<array1>, <array2>)
## 返回值
-返回欧几里得空间中两点(向量值为坐标)之间的距离。如果输入 array 为 NULL,或者 array 中任何元素为 NULL,则返回 NULL。
+返回欧几里得空间中两点(向量值为坐标)之间的距离,返回类型为 `FLOAT`。
+
+如果任一输入数组为 `NULL`,或包含 `NULL` 元素,函数会报错。
## 举例
@@ -40,3 +42,23 @@ SELECT L2_DISTANCE([4, 5], [6, 8]),L2_DISTANCE([3, 6], [4,
5]);
| 3.605551 | 1.414214 |
+-----------------------------+-----------------------------+
```
+
+如果输入数组为 `NULL`,函数会报错:
+
+```sql
+SELECT L2_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot be
null
+```
+
+如果输入数组包含 `NULL` 元素,函数会报错:
+
+```sql
+SELECT L2_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot
have null
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
index 316bfd72c6f..049ee1a2508 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/cosine-distance.md
@@ -25,7 +25,9 @@ COSINE_DISTANCE(<array1>, <array2>)
## Return Value
-Returns the cosine distance between two vectors (where the vector values are
coordinates). If the input array is NULL, or any element in the array is NULL,
then NULL is returned.
+Returns the cosine distance between two vectors (where the vector values are
coordinates). The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -40,3 +42,23 @@ SELECT COSINE_DISTANCE([1, 2], [2, 3]),COSINE_DISTANCE([3,
6], [4, 7]);
| 0.007722139 | 0.001539648 |
+---------------------------------+---------------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT COSINE_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT COSINE_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function cosine_distance cannot
have null
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
index df889406d07..9e643f8d2b5 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product-approximate.md
@@ -25,7 +25,9 @@ INNER_PRODUCT_APPROXIMATE(<array1>, <array2>)
## Return Value
-Returns the scalar product of two vectors of the same size. If the input array
is NULL, or any element in array is NULL, then NULL is returned.
+Returns the scalar product of two vectors of the same size. The return type is
`FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Examples
@@ -85,3 +87,23 @@ Result
+--------+----------+
10 rows in set (0.04 sec)
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
inner_product_approximate cannot have null
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
index 1036da01320..c64ca9ea074 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/inner-product.md
@@ -25,7 +25,9 @@ INNER_PRODUCT(<array1>, <array2>)
## Return Value
-Returns the scalar product of two vectors of the same size. If the input array
is NULL, or any element in array is NULL, then NULL is returned.
+Returns the scalar product of two vectors of the same size. The return type is
`FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Examples
@@ -40,3 +42,23 @@ SELECT INNER_PRODUCT([1, 2], [2, 3]),INNER_PRODUCT([3, 6],
[4, 7]);
| 8 | 54 |
+-------------------------------+-------------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT INNER_PRODUCT([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function inner_product cannot
have null
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
index 924350fe39b..46b51830371 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l1-distance.md
@@ -25,7 +25,9 @@ L1_DISTANCE(<array1>, <array2>)
## Return Value
-Returns the distance between two points (vector values are coordinates) in L1
space. If the input array is NULL, or any element in the array is NULL, then
NULL is returned.
+Returns the distance between two points (vector values are coordinates) in L1
space. The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -40,3 +42,23 @@ SELECT L1_DISTANCE([4, 5], [6, 8]),L1_DISTANCE([3, 6], [4,
5]);
| 5 | 2 |
+-----------------------------+-----------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT L1_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot be
null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT L1_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l1_distance cannot
have null
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
index 878dfff6137..bc7fd6dab63 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance-approximate.md
@@ -25,7 +25,9 @@ L2_DISTANCE_APPROXIMATE(<array1>, <array2>)
## Return Value
-Returns the distance between two points (vector values are coordinates) in
Euclidean space. If the input array is NULL, or any element in the array is
NULL, then NULL is returned.
+Returns the distance between two points (vector values are coordinates) in
Euclidean space. The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -85,3 +87,23 @@ Result
+--------+----------+
10 rows in set (0.08 sec)
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot be null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE_APPROXIMATE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function
l2_distance_approximate cannot have null
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
index 917f8ef883e..9e61fdeb124 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/ai-functions/distance-functions/l2-distance.md
@@ -25,7 +25,9 @@ L2_DISTANCE(<array1>, <array2>)
## Return Value
-Returns the distance between two points (vector values are coordinates) in
Euclidean space. If the input array is NULL, or any element in the array is
NULL, then NULL is returned.
+Returns the distance between two points (vector values are coordinates) in
Euclidean space. The return type is `FLOAT`.
+
+If either input array is `NULL`, or contains a `NULL` element, the function
returns an error.
## Example
@@ -40,3 +42,23 @@ SELECT L2_DISTANCE([4, 5], [6, 8]),L2_DISTANCE([3, 6], [4,
5]);
| 3.605551 | 1.414214 |
+-----------------------------+-----------------------------+
```
+
+If an input array is `NULL`, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE(NULL, [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot be
null
+```
+
+If an input array contains a `NULL` element, the function returns an error:
+
+```sql
+SELECT L2_DISTANCE([1, NULL], [1, 2]);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage =
(127.0.0.1)[INVALID_ARGUMENT]First argument for function l2_distance cannot
have null
+```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]