This is an automated email from the ASF dual-hosted git repository.

yiguolei 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 009d292800f [doc](function) support from/to_hex binary function (#2917)
009d292800f is described below

commit 009d292800f40952d31f78333fa332b6781ecd5c
Author: zhangstar333 <[email protected]>
AuthorDate: Sat Oct 11 16:29:31 2025 +0800

    [doc](function) support from/to_hex binary function (#2917)
    
    ## Versions
    
    - [x] dev
    - [ ] 3.0
    - [ ] 2.1
    - [ ] 2.0
    
    ## Languages
    
    - [x] Chinese
    - [x] English
    
    ## Docs Checklist
    
    - [ ] Checked by AI
    - [ ] Test Cases Built
---
 .../scalar-functions/binary-functions/from_hex.md  | 72 +++++++++++++++++++++
 .../scalar-functions/binary-functions/to_hex.md    | 74 +++++++++++++++++++++
 .../docusaurus-plugin-content-docs/current.json    |  4 ++
 .../scalar-functions/binary-functions/from_hex.md  | 71 ++++++++++++++++++++
 .../scalar-functions/binary-functions/to_hex.md    | 75 ++++++++++++++++++++++
 sidebars.json                                      |  8 +++
 6 files changed, 304 insertions(+)

diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/binary-functions/from_hex.md 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/from_hex.md
new file mode 100644
index 00000000000..721e30ae090
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/from_hex.md
@@ -0,0 +1,72 @@
+---
+{
+    "title": "FROM_HEX",
+    "language": "en"
+}
+---
+
+## Description
+
+Convert the input binary data into a string converted using hexadecimal 
encoding.
+
+## Alias
+
+FROM_BINARY
+
+## Syntax
+
+```sql
+FROM_HEX ( <varbinary> )
+```
+
+## Parameters
+
+| Parameter | Description |
+|-------|--------------|
+| `<varbinary>` | Input parameter is binary data |
+
+## Return value
+
+Convert the input binary data into a string using hexadecimal encoding.
+
+## Example
+
+```sql
+SELECT FROM_HEX(NULL);
+```
+
+```text
++----------------+
+| FROM_HEX(NULL) |
++----------------+
+| NULL           |
++----------------+
+```
+
+```sql
+SELECT FROM_HEX(X'AB');
+```
+
+```text
++-----------------+
+| FROM_HEX(X'AB') |
++-----------------+
+| AB              |
++-----------------+
+```
+
+```sql
+select *, from_binary(varbinary_c) from 
mysql_all_type_test.test_varbinary_db.test_varbinary
+```
+
+```text
++------+----------------------------+--------------------------+
+| id   | varbinary_c                | from_binary(varbinary_c) |
++------+----------------------------+--------------------------+
+|    1 | 0x48656C6C6F20576F726C64   | 48656C6C6F20576F726C64   |
+|    2 | 0x48656C6C6F20576F726C6421 | 48656C6C6F20576F726C6421 |
+|    3 | 0x48656C6C6F20576F726C6421 | 48656C6C6F20576F726C6421 |
+|    4 | NULL                       | NULL                     |
+|    5 | 0xAB                       | AB                       |
++------+----------------------------+--------------------------+
+```
\ No newline at end of file
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/binary-functions/to_hex.md 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/to_hex.md
new file mode 100644
index 00000000000..0ed98201696
--- /dev/null
+++ b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/to_hex.md
@@ -0,0 +1,74 @@
+---
+{
+    "title": "TO_HEX",
+    "language": "en"
+}
+---
+
+## Description
+
+Convert the input string into the corresponding byte sequence in hexadecimal.
+
+## Alias
+
+TO_BINARY
+
+## Syntax
+
+```sql
+TO_HEX(<str>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<str>` | The string data to be converted |
+
+## Return Value
+
+Return the decoded VARBINARY (displayed in hexadecimal format with a 0x 
prefix).
+Return NULL if any of the following conditions are met:
+The input is NULL;
+The input length is 0;
+The input length is odd;
+The input contains characters other than [0-9a-fA-F];
+The length of the decoded result is 0 (decoding failed).
+
+## Examples
+
+```sql
+select to_hex(NULL),to_hex('a');
+```
+
+```text
++----------------------------+--------------------------+
+| to_hex(NULL)               | to_hex('a')              |
++----------------------------+--------------------------+
+| NULL                       | NULL                     |
++----------------------------+--------------------------+
+```
+
+```sql
+select to_hex('ab');
+```
+
+```text
++----------------------------+
+| to_hex('ab')               |
++----------------------------+
+| 0xAB                       |
++----------------------------+
+```
+
+```sql
+select to_hex('000A');
+```
+
+```text
++--------------------------------+
+| to_hex('000A')                 |
++--------------------------------+
+| 0x000A                         |
++--------------------------------+
+```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current.json 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current.json
index 85e860c2de2..9a3168b67d8 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current.json
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current.json
@@ -583,6 +583,10 @@
     "message": "HLL 函数",
     "description": "The label for category HLL Functions in sidebar docs"
   },
+  "sidebar.docs.category.Binary Functions": {
+    "message": "Binary 函数",
+    "description": "The label for category Binary Functions in sidebar docs"
+  },
   "sidebar.docs.category.System Functions": {
     "message": "系统函数",
     "description": "The label for category System Functions in sidebar docs"
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/from_hex.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/from_hex.md
new file mode 100644
index 00000000000..3852a80c271
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/from_hex.md
@@ -0,0 +1,71 @@
+---
+{
+    "title": "FROM_HEX",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+将输入的二进制数据转换成使用十六进制编码转换后的字符串
+
+## 别名
+
+FROM_BINARY
+
+## 语法
+
+```sql
+FROM_HEX ( <varbinary> )
+```
+
+## 参数
+
+| 参数    | 说明           |
+|-------|--------------|
+| `<varbinary>` | 待转换的二进制数据 |
+
+## 返回值
+
+将输入的二进制数据使用十六进制编码转换成字符串。
+
+## 举例
+
+```sql
+SELECT FROM_HEX(NULL);
+```
+
+```text
++----------------+
+| FROM_HEX(NULL) |
++----------------+
+| NULL           |
++----------------+
+```
+
+```sql
+SELECT FROM_HEX(X'AB');
+```
+
+```text
++-----------------+
+| FROM_HEX(X'AB') |
++-----------------+
+| AB              |
++-----------------+
+```
+
+```sql
+select *, from_binary(varbinary_c) from 
mysql_all_type_test.test_varbinary_db.test_varbinary
+```
+
+```text
++------+----------------------------+--------------------------+
+| id   | varbinary_c                | from_binary(varbinary_c) |
++------+----------------------------+--------------------------+
+|    1 | 0x48656C6C6F20576F726C64   | 48656C6C6F20576F726C64   |
+|    2 | 0x48656C6C6F20576F726C6421 | 48656C6C6F20576F726C6421 |
+|    3 | 0x48656C6C6F20576F726C6421 | 48656C6C6F20576F726C6421 |
+|    4 | NULL                       | NULL                     |
+|    5 | 0xAB                       | AB                       |
++------+----------------------------+--------------------------+
+```
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/to_hex.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/to_hex.md
new file mode 100644
index 00000000000..672422c92e8
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/to_hex.md
@@ -0,0 +1,75 @@
+---
+{
+    "title": "TO_HEX",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+将输入的字符串按十六进制转换成对应的字节序列
+
+## 别名
+
+TO_BINARY
+
+## 语法
+
+```sql
+TO_HEX(<str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<str>` | 待转换的字符串数据 |
+
+## 返回值
+
+返回解码后的 VARBINARY(以 0x 前缀的十六进制形式展示)。
+出现以下任一情况返回 NULL:
+
+输入为 NULL;
+输入长度为 0;
+输入长度为奇数;
+含有非 [0-9a-fA-F] 的字符;
+解码结果长度为 0(解码失败)。
+
+## 举例
+
+```sql
+select to_hex(NULL),to_hex('a');
+```
+
+```text
++----------------------------+--------------------------+
+| to_hex(NULL)               | to_hex('a')              |
++----------------------------+--------------------------+
+| NULL                       | NULL                     |
++----------------------------+--------------------------+
+```
+
+```sql
+select to_hex('ab');
+```
+
+```text
++----------------------------+
+| to_hex('ab')               |
++----------------------------+
+| 0xAB                       |
++----------------------------+
+```
+
+```sql
+select to_hex('000A');
+```
+
+```text
++--------------------------------+
+| to_hex('000A')                 |
++--------------------------------+
+| 0x000A                         |
++--------------------------------+
+```
diff --git a/sidebars.json b/sidebars.json
index 62451e92f32..a549faac741 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1693,6 +1693,14 @@
                                         
"sql-manual/sql-functions/scalar-functions/hll-functions/hll-to-base64"
                                     ]
                                 },
+                                {
+                                    "type": "category",
+                                    "label": "Binary Functions",
+                                    "items": [
+                                        
"sql-manual/sql-functions/scalar-functions/binary-functions/from_hex",
+                                        
"sql-manual/sql-functions/scalar-functions/binary-functions/to_hex"
+                                    ]
+                                },
                                 {
                                     "type": "category",
                                     "label": "System Functions",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to