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

zhangstar333 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 f52dc8cb860 [doc](function) support sub_binary, length, 
to_base64_binary, from_base64_binary (#2947)
f52dc8cb860 is described below

commit f52dc8cb860ad878755a99b865cfe9ca72ecda76
Author: admiring_xm <[email protected]>
AuthorDate: Fri Oct 24 11:15:13 2025 +0800

    [doc](function) support sub_binary, length, to_base64_binary, 
from_base64_binary (#2947)
    
    ## Versions
    
    - [x] dev
    - [ ] 3.0
    - [ ] 2.1
    - [ ] 2.0
    
    ## Languages
    
    - [x] Chinese
    - [x] English
    
    ## Docs Checklist
    
    - [ ] Checked by AI
    - [ ] Test Cases Built
---
 .../binary-functions/from-base64-binary.md         |  72 ++++++++++++++
 .../binary-functions/sub-binary.md                 | 108 +++++++++++++++++++++
 .../binary-functions/to-base64-binary.md           |  55 +++++++++++
 .../string-functions/from-base64.md                |   2 +-
 .../scalar-functions/string-functions/length.md    |  16 ++-
 .../binary-functions/from-base64-binary.md         |  71 ++++++++++++++
 .../binary-functions/sub-binary.md                 | 107 ++++++++++++++++++++
 .../binary-functions/to-base64-binary.md           |  55 +++++++++++
 .../string-functions/from-base64.md                |   2 +-
 .../scalar-functions/string-functions/length.md    |  16 ++-
 sidebars.json                                      |   3 +
 11 files changed, 501 insertions(+), 6 deletions(-)

diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/binary-functions/from-base64-binary.md
 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/from-base64-binary.md
new file mode 100644
index 00000000000..d8dbef703bd
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/from-base64-binary.md
@@ -0,0 +1,72 @@
+---
+{
+    "title": "FROM_BASE64_BINARY",
+    "language": "en"
+}
+---
+
+## Description
+
+The FROM_BASE64_BINARY function decodes a Base64-encoded string and returns 
the result as a VARBINARY value.
+
+Special cases:
+
+- If the input string is not a valid Base64-encoded string, the function 
returns NULL.
+
+## Syntax
+
+```sql
+FROM_BASE64_BINARY ( <str> )
+```
+
+## Parameters
+
+| Parameter | Description                                            |
+| --------- | ------------------------------------------------------ |
+| `<str>`   | The Base64-encoded string to be decoded.               |
+
+## Return value
+
+The parameter `<str>` decoded from Base64, returned as a VARBINARY result.
+
+Special cases:
+
+- When the input string is invalid (contains characters not possible in Base64 
encoding), returns NULL.
+
+## Example
+
+```sql
+SELECT FROM_BASE64_BINARY('MQ==');
+```
+
+```text
++--------------------------------------------------------+
+| FROM_BASE64_BINARY('MQ==')                             |
++--------------------------------------------------------+
+| 0x31                                                   |
++--------------------------------------------------------+
+```
+
+```sql
+SELECT FROM_BASE64_BINARY('MjM0');
+```
+
+```text
++--------------------------------------------------------+
+| FROM_BASE64_BINARY('MjM0')                             |
++--------------------------------------------------------+
+| 0x323334                                               |
++--------------------------------------------------------+
+```
+
+```sql
+SELECT FROM_BASE64_BINARY(NULL);
+```
+
+```text
++----------------------------------------------------+
+| FROM_BASE64_BINARY(NULL)                           |
++----------------------------------------------------+
+| NULL                                               |
++----------------------------------------------------+
+```
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/binary-functions/sub-binary.md 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/sub-binary.md
new file mode 100644
index 00000000000..469a12a7fd7
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/sub-binary.md
@@ -0,0 +1,108 @@
+---
+{
+    "title": "SUB_BINARY",
+    "language": "en"
+}
+---
+
+## Description
+
+The SUB_BINARY function extracts a binary subsequence from a VARBINARY value. 
You can specify the starting position and the length of bytes to extract. The 
first byte position in the binary is 1.
+
+## Syntax
+
+```sql
+sub_binary(<bin>, <pos> [, <len>])
+```
+
+## Parameters
+
+| Parameter | Description                                               |
+| --------- | --------------------------------------------------------- |
+| `<bin>`   | Source binary value. Type: VARBINARY                      |
+| `<pos>`   | Starting byte position, can be negative. Type: INT        |
+| `<len>`   | Optional parameter, number of bytes to extract. Type: INT |
+
+## Return value
+
+Returns VARBINARY type, representing the extracted binary subsequence.
+
+Special cases:
+
+- If any parameter is NULL, returns NULL.
+- If pos is 0, returns an empty binary.
+- If pos is negative, counts from the end of the binary backwards.
+- If pos exceeds the binary length, returns an empty binary.
+- If len is not specified, returns all bytes from pos to the end of the binary.
+
+## Example
+
+1. Basic usage (specify starting position)
+
+```sql
+SELECT sub_binary(x'61626331', 2);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331', 2)                             |
++--------------------------------------------------------+
+| 0x626331                                               |
++--------------------------------------------------------+
+```
+
+2. Using negative position
+
+```sql
+SELECT sub_binary(x'61626331', -2);
+```
+
+```text
++----------------------------------------------------------+
+| sub_binary(x'61626331', -2)                              |
++----------------------------------------------------------+
+| 0x6331                                                   |
++----------------------------------------------------------+
+```
+
+3. Case when position is 0
+
+```sql
+SELECT sub_binary(x'61626331', 0);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331', 0)                             |
++--------------------------------------------------------+
+| 0x                                                     |
++--------------------------------------------------------+
+```
+
+4. Position exceeds binary length
+
+```sql
+SELECT sub_binary(x'61626331', 5);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331', 5)                             |
++--------------------------------------------------------+
+| 0x                                                     |
++--------------------------------------------------------+
+```
+
+5. Specifying length parameter
+
+```sql
+SELECT sub_binary(x'61626331646566', 2, 2);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331646566', 2, 2)                    |
++--------------------------------------------------------+
+| 0x6263                                                 |
++--------------------------------------------------------+
+```
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/binary-functions/to-base64-binary.md
 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/to-base64-binary.md
new file mode 100644
index 00000000000..f9b9cf60191
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/binary-functions/to-base64-binary.md
@@ -0,0 +1,55 @@
+---
+{
+    "title": "TO_BASE64_BINARY",
+    "language": "en"
+}
+---
+
+## Description
+
+The TO_BASE64_BINARY function converts the input binary string into Base64 
encoding format. Base64 encoding converts arbitrary binary data into a string 
composed of 64 characters.
+
+## Syntax
+
+```sql
+TO_BASE64_BINARY(<bin>)
+```
+
+## Parameters
+| Parameter | Description                                    |
+| --------- | ---------------------------------------------- |
+| `<bin>` | The binary to be Base64 encoded. Type: VARBINARY |
+
+## Return Value
+
+Returns VARCHAR type, representing the Base64 encoded string.
+
+Special cases:
+- If input is NULL, returns NULL
+- If input is an empty string, returns an empty string
+
+## Examples
+
+1. Single character encoding
+```sql
+SELECT to_base64_binary(x'12');
+```
+```text
++-------------------------+
+| to_base64_binary(x'12') |
++-------------------------+
+| Eg==                    |
++-------------------------+
+```
+
+2. Multiple character encoding
+```sql
+SELECT to_base64_binary(x'234AAA');
+```
+```text
++-----------------------------+
+| to_base64_binary(x'234AAA') |
++-----------------------------+
+| I0qq                        |
++-----------------------------+
+```
\ No newline at end of file
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
 
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
index f925d0120f9..dd8a8e22357 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
@@ -25,7 +25,7 @@ FROM_BASE64 ( <str> )
 
 ## Return value
 
-Parameter <str> The result of Base64 decoding. Special cases:
+Parameter `<str>` The result of Base64 decoding. Special cases:
 
 - When the input string is incorrect (a string that is not possible after 
Base64 encoding appears), NULL will be returned.
 
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/string-functions/length.md 
b/docs/sql-manual/sql-functions/scalar-functions/string-functions/length.md
index c70ba12e9f9..5519407badb 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/string-functions/length.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/string-functions/length.md
@@ -7,7 +7,7 @@
 
 ## Description
 
-Returns the number of bytes in a string.
+Returns the number of bytes in a string or a binary string.
 
 ## Syntax
 
@@ -19,7 +19,7 @@ LENGTH ( <str> )
 
 | Parameter | Description |
 |-----------| --------------- |
-| `<str>`   | The string whose bytes need to be calculated |
+| `<str>`   | The string or binary string whose bytes need to be calculated |
 
 ## Return Value
 
@@ -37,4 +37,16 @@ SELECT LENGTH("abc"),length("中国")
 +---------------+------------------+
 |             3 |                6 |
 +---------------+------------------+
+```
+
+```sql
+SELECT length(x'34AAA'), length(x'34AAA');
+```
+
+```text
++------------------+------------------+
+| length(x'34AAA') | length(x'34AAA') |
++------------------+------------------+
+|                3 |                3 |
++------------------+------------------+
 ```
\ 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/from-base64-binary.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/from-base64-binary.md
new file mode 100644
index 00000000000..0ae17300972
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/from-base64-binary.md
@@ -0,0 +1,71 @@
+---
+{
+    "title": "FROM_BASE64_BINARY",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+FROM_BASE64_BINARY 函数用于对输入字符串进行 Base64 解码,并返回结果的 VARBINARY 类型值。
+
+特殊情况:
+
+- 如果输入字符串不是合法的 Base64 编码字符串,则返回 NULL。
+
+## 语法
+
+```sql
+FROM_BASE64_BINARY ( <str> )
+```
+
+## 参数
+
+| 参数      | 说明              |
+|---------|-----------------|
+| `<str>` | 需要被 Base64 解码的字符串 |
+
+## 返回值
+
+参数 `<str>` 通过 Base64 解码后的 VARBINARY 结果。特殊情况:
+
+- 当输入字符串不正确时(出现非 Base64 编码后可能出现的字符串)将会返回 NULL
+
+## 举例
+
+
+```sql
+SELECT FROM_BASE64_BINARY('MQ==');
+```
+
+```text
++--------------------------------------------------------+
+| FROM_BASE64_BINARY('MQ==')                             |
++--------------------------------------------------------+
+| 0x31                                                   |
++--------------------------------------------------------+
+```
+
+```sql
+SELECT FROM_BASE64_BINARY('MjM0');
+```
+
+```text
++--------------------------------------------------------+
+| FROM_BASE64_BINARY('MjM0')                             |
++--------------------------------------------------------+
+| 0x323334                                               |
++--------------------------------------------------------+
+```
+
+```sql
+SELECT FROM_BASE64_BINARY(NULL);
+```
+
+```text
++----------------------------------------------------+
+| FROM_BASE64_BINARY(NULL)                           |
++----------------------------------------------------+
+| NULL                                               |
++----------------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/sub-binary.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/sub-binary.md
new file mode 100644
index 00000000000..40469818c37
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/sub-binary.md
@@ -0,0 +1,107 @@
+---
+{
+    "title": "SUB_BINARY",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+SUB_BINARY 函数用于从 VARBINARY 类型的二进制值中提取一个子序列。可以指定起始字节位置和提取的字节长度。二进制数据的首字节位置为 1。
+
+## 语法
+
+```sql
+sub_binary(<bin>, <pos> [, <len>])
+```
+
+## 参数
+
+| 参数      | 说明                    |
+| ------- | --------------------- |
+| `<bin>` | 源二进制值。类型:VARBINARY    |
+| `<pos>` | 起始字节位置,可以为负数。类型:INT   |
+| `<len>` | 可选参数,表示要提取的字节数。类型:INT |
+
+## 返回值
+
+返回 VARBINARY 类型,表示提取的二进制子序列。
+
+特殊情况:
+- 如果任意参数为 NULL,返回 NULL
+- 如果 pos 为 0,返回空二进制
+- 如果 pos 为负数,则从二进制末尾开始反向计数
+- 如果 pos 超出二进制长度,返回空二进制
+- 如果未指定 len,则返回从 pos 到末尾的所有字节
+
+## 示例
+
+1. 基本用法(指定起始位置)
+
+```sql
+SELECT sub_binary(x'61626331', 2);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331', 2)                             |
++--------------------------------------------------------+
+| 0x626331                                               |
++--------------------------------------------------------+
+```
+
+2. 使用负数位置
+
+```sql
+SELECT sub_binary(x'61626331', -2);
+```
+
+```text
++----------------------------------------------------------+
+| sub_binary(x'61626331', -2)                              |
++----------------------------------------------------------+
+| 0x6331                                                   |
++----------------------------------------------------------+
+```
+
+3. 位置为 0 的情况
+
+```sql
+SELECT sub_binary(x'61626331', 0);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331', 0)                             |
++--------------------------------------------------------+
+| 0x                                                     |
++--------------------------------------------------------+
+```
+
+4. 位置超出二进制长度
+
+```sql
+SELECT sub_binary(x'61626331', 5);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331', 5)                             |
++--------------------------------------------------------+
+| 0x                                                     |
++--------------------------------------------------------+
+```
+
+5. 指定长度参数
+
+```sql
+SELECT sub_binary(x'61626331646566', 2, 2);
+```
+
+```text
++--------------------------------------------------------+
+| sub_binary(x'61626331646566', 2, 2)                    |
++--------------------------------------------------------+
+| 0x6263                                                 |
++--------------------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/to-base64-binary.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/to-base64-binary.md
new file mode 100644
index 00000000000..0416507e767
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/binary-functions/to-base64-binary.md
@@ -0,0 +1,55 @@
+---
+{
+    "title": "TO_BASE64_BINARY",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+TO_BASE64_BINARY 函数用于将输入的二进制串转换为 Base64 编码格式。Base64 编码可以将任意二进制数据转换成由 64 
个字符组成的字符串。
+
+## 语法
+
+```sql
+TO_BASE64_BINARY(<bin>)
+```
+
+## 参数
+| 参数 | 说明                                        |
+| ---- | ------------------------------------------- |
+| `<bin>` | 需要进行 Base64 编码的二进制串。类型:VARBINARY |
+
+## 返回值
+
+返回 VARCHAR 类型,表示 Base64 编码后的字符串。
+
+特殊情况:
+- 如果输入为 NULL,返回 NULL
+- 如果输入为空字符串,返回空字符串
+
+## 示例
+
+1. 单字符编码
+```sql
+SELECT to_base64_binary(x'12');
+```
+```text
++-------------------------+
+| to_base64_binary(x'12') |
++-------------------------+
+| Eg==                    |
++-------------------------+
+```
+
+2. 多字符编码
+```sql
+SELECT to_base64_binary(x'234AAA');
+```
+```text
++-----------------------------+
+| to_base64_binary(x'234AAA') |
++-----------------------------+
+| I0qq                        |
++-----------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
index f32fd804035..c8000cf272f 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/from-base64.md
@@ -25,7 +25,7 @@ FROM_BASE64 ( <str> )
 
 ## 返回值
 
-参数 <str> 通过 Base64 解码后的结果。特殊情况:
+参数 `<str>` 通过 Base64 解码后的结果。特殊情况:
 
 - 当输入字符串不正确时(出现非 Base64 编码后可能出现的字符串)将会返回 NULL
 
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/length.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/length.md
index 9c4b3b614a5..e2963040b7c 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/length.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/length.md
@@ -7,7 +7,7 @@
 
 ## 描述
 
-返回字符串的字节数。
+返回字符串或者二进制串的字节数。
 
 ## 语法
 
@@ -19,7 +19,7 @@ LENGTH ( <str> )
 
 | 参数      | 说明            |
 |---------|---------------|
-| `<str>` | 需要计算字节的字符串    |
+| `<str>` | 需要计算字节的字符串或者二进制串    |
 
 ## 返回值
 
@@ -37,4 +37,16 @@ SELECT LENGTH("abc"),length("中国")
 +---------------+------------------+
 |             3 |                6 |
 +---------------+------------------+
+```
+
+```sql
+SELECT length(x'34AAA'), length(x'34AAA');
+```
+
+```text
++------------------+------------------+
+| length(x'34AAA') | length(x'34AAA') |
++------------------+------------------+
+|                3 |                3 |
++------------------+------------------+
 ```
\ No newline at end of file
diff --git a/sidebars.json b/sidebars.json
index 4ec9abcdf78..803a41da95b 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1728,7 +1728,10 @@
                                     "type": "category",
                                     "label": "Binary Functions",
                                     "items": [
+                                        
"sql-manual/sql-functions/scalar-functions/binary-functions/from-base64-binary",
                                         
"sql-manual/sql-functions/scalar-functions/binary-functions/from_hex",
+                                        
"sql-manual/sql-functions/scalar-functions/binary-functions/sub-binary",
+                                        
"sql-manual/sql-functions/scalar-functions/binary-functions/to-base64-binary",
                                         
"sql-manual/sql-functions/scalar-functions/binary-functions/to_hex"
                                     ]
                                 },


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

Reply via email to