This is an automated email from the ASF dual-hosted git repository.
zclllyybb 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 61c1b44b60f [doc] Fix the inaccurate behavior of some functions in the
document (#3849)
61c1b44b60f is described below
commit 61c1b44b60f512744853806c4228785afc66aaa0
Author: linrrarity <[email protected]>
AuthorDate: Mon Jun 1 11:47:16 2026 +0800
[doc] Fix the inaccurate behavior of some functions in the document (#3849)
## Versions
- [x] dev
- [x] 4.x
- [x] 3.x
- [x] 2.1 or older (not covered by version/language sync gate)
## Languages
- [x] Chinese
- [x] English
- [ ] Japanese candidate translation needed
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
- [ ] Updated required version and language counterparts, or explained
why not
- [ ] If only one language changed, confirmed whether source/translation
counterparts need sync
---
.../scalar-functions/date-time-functions/hour.md | 3 +--
.../scalar-functions/date-time-functions/minute.md | 3 +--
.../string-functions/split-part.md | 9 ++++----
.../scalar-functions/string-functions/unhex.md | 6 +++---
.../scalar-functions/date-time-functions/hour.md | 3 +--
.../scalar-functions/date-time-functions/minute.md | 24 ++++++++++++++--------
.../string-functions/split-part.md | 10 ++++-----
.../scalar-functions/string-functions/unhex.md | 8 ++++----
.../string-functions/split-part.md | 12 +++++++++++
.../scalar-functions/string-functions/unhex.md | 20 ++++++++++++++----
.../string-functions/split-part.md | 13 ++++++++++++
.../scalar-functions/string-functions/unhex.md | 22 +++++++++++++++-----
.../scalar-functions/date-time-functions/hour.md | 3 +--
.../scalar-functions/date-time-functions/minute.md | 3 +--
.../string-functions/split-part.md | 10 ++++-----
.../scalar-functions/string-functions/unhex.md | 8 ++++----
.../string-functions/split-part.md | 13 ++++++++++++
.../scalar-functions/string-functions/unhex.md | 14 ++++++++++++-
.../string-functions/split-part.md | 13 ++++++++++++
.../scalar-functions/string-functions/unhex.md | 16 +++++++++++++--
.../scalar-functions/date-time-functions/hour.md | 3 +--
.../scalar-functions/date-time-functions/minute.md | 3 +--
.../string-functions/split-part.md | 9 ++++----
.../scalar-functions/string-functions/unhex.md | 6 +++---
24 files changed, 167 insertions(+), 67 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
index 41d5dccd970..4d1fa83755e 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
@@ -73,12 +73,11 @@ select hour("2022-12-12");
| 0 |
+--------------------+
--- Will not automatically convert input time string to time, returns NULL
select hour('14:30:00') as normal_hour;
+-------------+
| normal_hour |
+-------------+
-| NULL |
+| 14 |
+-------------+
-- Input parameter is NULL, returns NULL
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
index 275dd7ea94d..c816451cc34 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
@@ -50,12 +50,11 @@ SELECT MINUTE('2023-05-01 10:05:30.123456') AS result;
| 5 |
+--------+
--- Does not automatically convert string to time type, returns NULL
SELECT MINUTE('14:25:45') AS result;
+--------+
| result |
+--------+
-| NULL |
+| 25 |
+--------+
-- Extract minute from DATE type (default time 00:00:00)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index f63d1c0860f..6db3e314193 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -30,6 +30,7 @@ Returns the specified part of the string split according to
the delimiter. Speci
- If any of the parameters is NULL, NULL is returned.
- When `<part_index>` is 0, NULL is returned.
+- When `<part_index>` is out of range, NULL is returned.
## Examples
@@ -86,11 +87,11 @@ SELECT SPLIT_PART('apple,banana,cherry', ',', -1),
SPLIT_PART('apple,banana,cher
SELECT SPLIT_PART('apple,banana', ',', 5), SPLIT_PART('apple,banana', ',', -5);
```
```text
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
| SPLIT_PART('apple,banana', ',', 5) | SPLIT_PART('apple,banana', ',', -5) |
-+-----------------------------------+------------------------------------+
-| | |
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
```
6. NULL value handling
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index e81c70fa3a6..251f79f0328 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -8,7 +8,7 @@
## Description
-The UNHEX function converts a hexadecimal string back to the original string,
serving as the inverse operation of the HEX function. This function converts
every two hexadecimal characters (0-9, A-F, a-f) into one byte. The UNHEX_NULL
function works identically but returns NULL instead of an empty string when
encountering invalid input. These functions are useful when handling binary
data, encrypted data, or data requiring hexadecimal representation.
+The UNHEX function converts a hexadecimal string back to the original string,
serving as the inverse operation of the HEX function. This function converts
every two hexadecimal characters (0-9, A-F, a-f) into one byte. The UNHEX_NULL
function works identically and returns NULL when encountering invalid input.
These functions are useful when handling binary data, encrypted data, or data
requiring hexadecimal representation.
:::tip
This function is supported since version 3.0.6.
@@ -36,7 +36,7 @@ Decoding rules:
- Result may contain unprintable characters
Special cases (UNHEX):
-- If input is NULL, returns empty string
+- If input is NULL, returns NULL
- If string length is 0 or odd, returns empty string
- If contains non-hexadecimal characters, returns empty string
@@ -103,7 +103,7 @@ SELECT UNHEX(NULL), UNHEX_NULL(NULL);
+-------------+-----------------+
| UNHEX(NULL) | UNHEX_NULL(NULL) |
+-------------+-----------------+
-| | NULL |
+| NULL | NULL |
+-------------+-----------------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
index 15a28e0f7e7..e7ea5105ab5 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
@@ -73,12 +73,11 @@ select hour("2022-12-12");
| 0 |
+--------------------+
----不会主动将输入时间字符串转换为 time ,返回 NULL
select hour('14:30:00') as normal_hour;
+-------------+
| normal_hour |
+-------------+
-| NULL |
+| 14 |
+-------------+
---输入参数为 NULL ,返回 NULL
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
index 95686da986b..7a1a229ea24 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
@@ -14,32 +14,39 @@ MINUTE 函数用于从输入的日期时间值中提取分钟部分的值,返
## 语法
+--------+
```sql
-MINUTE(`<date_or_time_expr>`)
+--------+
```
+--------+
+--------+
## 参数
+--------+
-| 参数 | 说明 |
| ---- | ---- |
+--------+
| ``<date_or_time_expr>`` | 输入的日期时间值,类型可以是 DATE、DATETIME,TIME,具体
datetime/date/time 请查看 [datetime
的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion),
[date
的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/date-conversion),[time
的转换](../../../../../current/sql-manual/basic-element/sql-data-types/conversion/time-conversion)
|
+--------+
+--------+
## 返回值
-
返回 INT 类型的整数,表示输入日期时间中的分钟值,取值范围为 0-59。
+--------+
+--------+
- 若输入为 DATE 类型(仅包含年月日),默认时间部分为 00:00:00,因此返回 0。
+--------+
- 若输入为 NULL,返回 NULL。
-
## 举例
+-------------+
+-------------+
```sql
+-------------+
--- 从 DATETIME 中提取分钟
SELECT MINUTE('2018-12-31 23:59:59') AS result;
+--------+
-| result |
-+--------+
-| 59 |
+--------+
--- 从含微秒的 DATETIME 中提取分钟(忽略微秒)
@@ -50,12 +57,11 @@ SELECT MINUTE('2023-05-01 10:05:30.123456') AS result;
| 5 |
+--------+
---- 不会主动将字符串转换为 time 类型,返回 NULL
SELECT MINUTE('14:25:45') AS result;
+--------+
| result |
+--------+
-| NULL |
+| 25 |
+--------+
--- 从 DATE 类型中提取分钟(默认时间 00:00:00)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index efc1c201206..8782206b057 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -30,7 +30,7 @@ SPLIT_PART(<str>, <separator>, <part_index>)
索引规则:
- part_index 从 1 开始计数
-- 如果 part_index 超出分割后数组的范围,返回空字符串
+- 如果 part_index 超出分割后数组的范围,返回 NULL
- 负数索引表示从末尾开始计数(-1 表示最后一个,-2 表示倒数第二个,依此类推)
特殊情况:
@@ -95,11 +95,11 @@ SELECT SPLIT_PART('apple,banana,cherry', ',', -1),
SPLIT_PART('apple,banana,cher
SELECT SPLIT_PART('apple,banana', ',', 5), SPLIT_PART('apple,banana', ',', -5);
```
```text
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
| SPLIT_PART('apple,banana', ',', 5) | SPLIT_PART('apple,banana', ',', -5) |
-+-----------------------------------+------------------------------------+
-| | |
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
```
6. NULL 值处理
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index 1304d703b48..7a1b237c38e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -2,13 +2,13 @@
{
"title": "UNHEX",
"language": "zh-CN",
- "description": "UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9,
A-F, a-f)转换为一个字节。UNHEXNULL 函数功能相同,但在遇到无效输入时返回 NULL 而不是空字符串。"
+ "description": "UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9,
A-F, a-f)转换为一个字节。UNHEX_NULL 函数功能相同,在遇到无效输入时也返回 NULL。"
}
---
## 描述
-UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9, A-F,
a-f)转换为一个字节。UNHEX_NULL 函数功能相同,但在遇到无效输入时返回 NULL
而不是空字符串。这两个函数在处理二进制数据、加密数据或需要十六进制表示的数据时非常有用。
+UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9, A-F,
a-f)转换为一个字节。UNHEX_NULL 函数功能相同,在遇到无效输入时也返回
NULL。这两个函数在处理二进制数据、加密数据或需要十六进制表示的数据时非常有用。
:::tip
该函数自 3.0.6 版本开始支持
@@ -37,7 +37,7 @@ UNHEX_NULL(<str>)
- 结果可能包含不可打印字符
特殊情况(UNHEX):
-- 如果输入为 NULL,返回空字符串
+- 如果输入为 NULL,返回 NULL
- 如果字符串长度为 0 或奇数,返回空字符串
- 如果包含非十六进制字符,返回空字符串
@@ -80,7 +80,7 @@ SELECT UNHEX(NULL), UNHEX_NULL(NULL);
+-------------+-----------------+
| UNHEX(NULL) | UNHEX_NULL(NULL) |
+-------------+-----------------+
-| | NULL |
+| NULL | NULL |
+-------------+-----------------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index 26df914ee9c..a62c83ec837 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -56,3 +56,15 @@ SELECT split_part('apple,banana,cherry', ',', 0);
| NULL |
+-------------------------------------------+
```
+
+5. 索引超出范围
+```sql
+SELECT split_part('apple,banana', ',', 5), split_part('apple,banana', ',', -5);
+```
+```text
++------------------------------------+-------------------------------------+
+| split_part('apple,banana', ',', 5) | split_part('apple,banana', ',', -5) |
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index 57831e8ba75..b101d383ef0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -2,13 +2,13 @@
{
"title": "UNHEX",
"language": "zh-CN",
- "description": "unhex
函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数是无效值时,将返回空字符串。"
+ "description": "unhex 函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数为 NULL
时,将返回 `NULL`;其他无效值返回空字符串。"
}
---
## 描述
-`unhex` 函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数是无效值时,将返回空字符串。
+`unhex` 函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数为 NULL 时,将返回
`NULL`;其他无效值返回空字符串。
## 语法
@@ -24,8 +24,8 @@ UNHEX(<str>)
## 返回值
-输入字符串,如果字符串长度为 0 或者为奇数,`unhex`函数返回空串。
-如果字符串中包含`[0-9]、[a-f]、[A-F]`之外的字符,`unhex`函数返回空串。
+输入字符串,如果字符串长度为 0 或者为奇数,`unhex`函数返回 空字符串。
+如果字符串中包含`[0-9]、[a-f]、[A-F]`之外的字符,`unhex`函数返回 空字符串。
其他情况每两个字符为一组转化为 16 进制后的字符,然后拼接成字符串输出。
## 举例
@@ -42,6 +42,18 @@ select unhex('@');
+------------+
```
+```sql
+select unhex(NULL);
+```
+
+```text
++-------------+
+| unhex(NULL) |
++-------------+
+| NULL |
++-------------+
+```
+
```sql
select unhex('41');
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index 26df914ee9c..23453d47b0a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -30,6 +30,7 @@ SPLIT_PART ( <str>, <separator>, <part_index> )
- 任意参数中有一个为 NULL,则返回 NULL
- 当`<part_index>`为 0 时,返回 NULL
+- 当`<part_index>`超出范围时,返回 NULL
## 举例
@@ -56,3 +57,15 @@ SELECT split_part('apple,banana,cherry', ',', 0);
| NULL |
+-------------------------------------------+
```
+
+```sql
+SELECT SPLIT_PART('apple,banana', ',', 5), SPLIT_PART('apple,banana', ',', -5);
+```
+
+```text
++------------------------------------+-------------------------------------+
+| SPLIT_PART('apple,banana', ',', 5) | SPLIT_PART('apple,banana', ',', -5) |
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index fa55526957d..bfd6624b4d7 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -2,14 +2,14 @@
{
"title": "UNHEX",
"language": "zh-CN",
- "description": "unhex
函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数是无效值时,将返回空字符串。 unhexnull
函数与unhex函数作用一致。但是当传入的参数是无效值时,将返回NULL。"
+ "description": "unhex 函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数为 NULL
时,将返回 `NULL`;其他无效值返回空字符串。 unhex_null 函数与unhex函数作用一致,但是当传入的参数为 NULL 时,也将返回
`NULL`。"
}
---
## 描述
-`unhex` 函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数是无效值时,将返回空字符串。
-`unhex_null` 函数与`unhex`函数作用一致。但是当传入的参数是无效值时,将返回`NULL`。
+`unhex` 函数用于将十六进制字符串转换为原始字符串。将每两个十六进制字符转换为一个字节。当传入的参数为 NULL 时,将返回
`NULL`;其他无效值返回空字符串。
+`unhex_null` 函数与`unhex`函数作用一致。但是当传入的参数为 NULL 时,也将返回`NULL`。
:::tip
unhex_null 函数自 3.0.6 版本开始支持。
@@ -29,8 +29,8 @@ UNHEX(<str>)
## 返回值
-输入字符串,如果字符串长度为 0 或者为奇数,`unhex`函数返回空串,`unhex_null`函数返回`NULL`;
-如果字符串中包含`[0-9]、[a-f]、[A-F]`之外的字符,`unhex`函数返回空串,`unhex_null`函数返回`NULL`;
+输入字符串,如果字符串长度为 0 或者为奇数,`unhex`函数返回 空字符串,`unhex_null`函数返回`NULL`;
+如果字符串中包含`[0-9]、[a-f]、[A-F]`之外的字符,`unhex`函数返回 空字符串,`unhex_null`函数返回`NULL`;
其他情况每两个字符为一组转化为 16 进制后的字符,然后拼接成字符串输出。
## 举例
@@ -47,6 +47,18 @@ select unhex('@');
+------------+
```
+```sql
+select unhex(NULL);
+```
+
+```text
++-------------+
+| unhex(NULL) |
++-------------+
+| NULL |
++-------------+
+```
+
```sql
select unhex_null('@');
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
index 15a28e0f7e7..e7ea5105ab5 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
@@ -73,12 +73,11 @@ select hour("2022-12-12");
| 0 |
+--------------------+
----不会主动将输入时间字符串转换为 time ,返回 NULL
select hour('14:30:00') as normal_hour;
+-------------+
| normal_hour |
+-------------+
-| NULL |
+| 14 |
+-------------+
---输入参数为 NULL ,返回 NULL
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
index 95686da986b..c93bcab0f9a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
@@ -50,12 +50,11 @@ SELECT MINUTE('2023-05-01 10:05:30.123456') AS result;
| 5 |
+--------+
---- 不会主动将字符串转换为 time 类型,返回 NULL
SELECT MINUTE('14:25:45') AS result;
+--------+
| result |
+--------+
-| NULL |
+| 25 |
+--------+
--- 从 DATE 类型中提取分钟(默认时间 00:00:00)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index efc1c201206..8782206b057 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -30,7 +30,7 @@ SPLIT_PART(<str>, <separator>, <part_index>)
索引规则:
- part_index 从 1 开始计数
-- 如果 part_index 超出分割后数组的范围,返回空字符串
+- 如果 part_index 超出分割后数组的范围,返回 NULL
- 负数索引表示从末尾开始计数(-1 表示最后一个,-2 表示倒数第二个,依此类推)
特殊情况:
@@ -95,11 +95,11 @@ SELECT SPLIT_PART('apple,banana,cherry', ',', -1),
SPLIT_PART('apple,banana,cher
SELECT SPLIT_PART('apple,banana', ',', 5), SPLIT_PART('apple,banana', ',', -5);
```
```text
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
| SPLIT_PART('apple,banana', ',', 5) | SPLIT_PART('apple,banana', ',', -5) |
-+-----------------------------------+------------------------------------+
-| | |
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
```
6. NULL 值处理
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index 1304d703b48..7a1b237c38e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -2,13 +2,13 @@
{
"title": "UNHEX",
"language": "zh-CN",
- "description": "UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9,
A-F, a-f)转换为一个字节。UNHEXNULL 函数功能相同,但在遇到无效输入时返回 NULL 而不是空字符串。"
+ "description": "UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9,
A-F, a-f)转换为一个字节。UNHEX_NULL 函数功能相同,在遇到无效输入时也返回 NULL。"
}
---
## 描述
-UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9, A-F,
a-f)转换为一个字节。UNHEX_NULL 函数功能相同,但在遇到无效输入时返回 NULL
而不是空字符串。这两个函数在处理二进制数据、加密数据或需要十六进制表示的数据时非常有用。
+UNHEX 函数用于将十六进制字符串转换为原始字符串,是 HEX 函数的逆操作。该函数将每两个十六进制字符(0-9, A-F,
a-f)转换为一个字节。UNHEX_NULL 函数功能相同,在遇到无效输入时也返回
NULL。这两个函数在处理二进制数据、加密数据或需要十六进制表示的数据时非常有用。
:::tip
该函数自 3.0.6 版本开始支持
@@ -37,7 +37,7 @@ UNHEX_NULL(<str>)
- 结果可能包含不可打印字符
特殊情况(UNHEX):
-- 如果输入为 NULL,返回空字符串
+- 如果输入为 NULL,返回 NULL
- 如果字符串长度为 0 或奇数,返回空字符串
- 如果包含非十六进制字符,返回空字符串
@@ -80,7 +80,7 @@ SELECT UNHEX(NULL), UNHEX_NULL(NULL);
+-------------+-----------------+
| UNHEX(NULL) | UNHEX_NULL(NULL) |
+-------------+-----------------+
-| | NULL |
+| NULL | NULL |
+-------------+-----------------+
```
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index a758d2df205..37a89e9b4e5 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -30,6 +30,7 @@ Returns the specified part of the string split according to
the delimiter. Speci
- If any of the parameters is NULL, NULL is returned.
- When `<part_index>` is 0, NULL is returned.
+- When `<part_index>` is out of range, NULL is returned.
## Examples
@@ -56,3 +57,15 @@ SELECT split_part('apple,banana,cherry', ',', 0);
| NULL |
+-------------------------------------------+
```
+
+5. Index out of range
+```sql
+SELECT split_part('apple,banana', ',', 5), split_part('apple,banana', ',', -5);
+```
+```text
++------------------------------------+-------------------------------------+
+| split_part('apple,banana', ',', 5) | split_part('apple,banana', ',', -5) |
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
+```
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index 1bda02b9560..64931c1097a 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -8,7 +8,7 @@
## Description
-The `unhex` function is used to convert a hexadecimal string back into the
original string. It converts every two hexadecimal characters into one byte.
When an invalid value is passed as a parameter, it will return empty string.
+The `unhex` function is used to convert a hexadecimal string back into the
original string. It converts every two hexadecimal characters into one byte.
When a NULL value is passed as a parameter, it will return NULL; otherwise
invalid values return an empty string.
## Syntax
@@ -42,6 +42,18 @@ select unhex('@');
+------------+
```
+```sql
+select unhex(NULL);
+```
+
+```text
++-------------+
+| unhex(NULL) |
++-------------+
+| NULL |
++-------------+
+```
+
```sql
select unhex('41');
```
diff --git
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index a758d2df205..9f711c9d6a3 100644
---
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -30,6 +30,7 @@ Returns the specified part of the string split according to
the delimiter. Speci
- If any of the parameters is NULL, NULL is returned.
- When `<part_index>` is 0, NULL is returned.
+- When `<part_index>` is out of range, NULL is returned.
## Examples
@@ -56,3 +57,15 @@ SELECT split_part('apple,banana,cherry', ',', 0);
| NULL |
+-------------------------------------------+
```
+
+```sql
+SELECT SPLIT_PART('apple,banana', ',', 5), SPLIT_PART('apple,banana', ',', -5);
+```
+
+```text
++------------------------------------+-------------------------------------+
+| SPLIT_PART('apple,banana', ',', 5) | SPLIT_PART('apple,banana', ',', -5) |
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
+```
diff --git
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index d5c86d4a1b9..3e10aace63c 100644
---
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -8,8 +8,8 @@
## Description
-The `unhex` function is used to convert a hexadecimal string back into the
original string. It converts every two hexadecimal characters into one byte.
When an invalid value is passed as a parameter, it will return empty string.
-The `unhex_null` function has the same effect as the `unhex` function.
However, when an invalid value is passed as a parameter, it will return NULL.
+The `unhex` function is used to convert a hexadecimal string back into the
original string. It converts every two hexadecimal characters into one byte.
When a NULL value is passed as a parameter, it will return NULL; otherwise
invalid values return an empty string.
+The `unhex_null` function has the same effect as the `unhex` function.
However, when a NULL value is passed as a parameter, it will return NULL.
:::tip
The `unhex_null` function is supported since version 3.0.6.
@@ -47,6 +47,18 @@ select unhex('@');
+------------+
```
+```sql
+select unhex(NULL);
+```
+
+```text
++-------------+
+| unhex(NULL) |
++-------------+
+| NULL |
++-------------+
+```
+
```sql
select unhex_null('@');
```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
index 41d5dccd970..4d1fa83755e 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/hour.md
@@ -73,12 +73,11 @@ select hour("2022-12-12");
| 0 |
+--------------------+
--- Will not automatically convert input time string to time, returns NULL
select hour('14:30:00') as normal_hour;
+-------------+
| normal_hour |
+-------------+
-| NULL |
+| 14 |
+-------------+
-- Input parameter is NULL, returns NULL
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
index 275dd7ea94d..c816451cc34 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/date-time-functions/minute.md
@@ -50,12 +50,11 @@ SELECT MINUTE('2023-05-01 10:05:30.123456') AS result;
| 5 |
+--------+
--- Does not automatically convert string to time type, returns NULL
SELECT MINUTE('14:25:45') AS result;
+--------+
| result |
+--------+
-| NULL |
+| 25 |
+--------+
-- Extract minute from DATE type (default time 00:00:00)
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
index f63d1c0860f..6db3e314193 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/split-part.md
@@ -30,6 +30,7 @@ Returns the specified part of the string split according to
the delimiter. Speci
- If any of the parameters is NULL, NULL is returned.
- When `<part_index>` is 0, NULL is returned.
+- When `<part_index>` is out of range, NULL is returned.
## Examples
@@ -86,11 +87,11 @@ SELECT SPLIT_PART('apple,banana,cherry', ',', -1),
SPLIT_PART('apple,banana,cher
SELECT SPLIT_PART('apple,banana', ',', 5), SPLIT_PART('apple,banana', ',', -5);
```
```text
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
| SPLIT_PART('apple,banana', ',', 5) | SPLIT_PART('apple,banana', ',', -5) |
-+-----------------------------------+------------------------------------+
-| | |
-+-----------------------------------+------------------------------------+
++------------------------------------+-------------------------------------+
+| NULL | NULL |
++------------------------------------+-------------------------------------+
```
6. NULL value handling
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
index e81c70fa3a6..251f79f0328 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/string-functions/unhex.md
@@ -8,7 +8,7 @@
## Description
-The UNHEX function converts a hexadecimal string back to the original string,
serving as the inverse operation of the HEX function. This function converts
every two hexadecimal characters (0-9, A-F, a-f) into one byte. The UNHEX_NULL
function works identically but returns NULL instead of an empty string when
encountering invalid input. These functions are useful when handling binary
data, encrypted data, or data requiring hexadecimal representation.
+The UNHEX function converts a hexadecimal string back to the original string,
serving as the inverse operation of the HEX function. This function converts
every two hexadecimal characters (0-9, A-F, a-f) into one byte. The UNHEX_NULL
function works identically and returns NULL when encountering invalid input.
These functions are useful when handling binary data, encrypted data, or data
requiring hexadecimal representation.
:::tip
This function is supported since version 3.0.6.
@@ -36,7 +36,7 @@ Decoding rules:
- Result may contain unprintable characters
Special cases (UNHEX):
-- If input is NULL, returns empty string
+- If input is NULL, returns NULL
- If string length is 0 or odd, returns empty string
- If contains non-hexadecimal characters, returns empty string
@@ -103,7 +103,7 @@ SELECT UNHEX(NULL), UNHEX_NULL(NULL);
+-------------+-----------------+
| UNHEX(NULL) | UNHEX_NULL(NULL) |
+-------------+-----------------+
-| | NULL |
+| NULL | NULL |
+-------------+-----------------+
```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]