This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 f33f3cfcfd8 [Feature](varbinary) Extend the digest function for
VarBinary type (#2919)
f33f3cfcfd8 is described below
commit f33f3cfcfd883df03a2eb48ea298abbe64825f43
Author: linrrarity <[email protected]>
AuthorDate: Sun Oct 5 21:05:46 2025 +0800
[Feature](varbinary) Extend the digest function for VarBinary type (#2919)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../encrypt-digest-functions/md5.md | 35 +++++++++++++++-------
.../encrypt-digest-functions/sha.md | 27 +++++++++++++----
.../encrypt-digest-functions/sha2.md | 31 +++++++++++++++++--
.../encrypt-digest-functions/sm3.md | 33 ++++++++++++++------
.../encrypt-digest-functions/xxhash-32.md | 33 ++++++++++++++++++--
.../encrypt-digest-functions/xxhash-64.md | 32 ++++++++++++++++++--
.../encrypt-digest-functions/md5.md | 31 ++++++++++++++-----
.../encrypt-digest-functions/sha.md | 27 +++++++++++++----
.../encrypt-digest-functions/sha2.md | 31 +++++++++++++++++--
.../encrypt-digest-functions/sm3.md | 31 ++++++++++++++-----
.../encrypt-digest-functions/xxhash-32.md | 33 ++++++++++++++++++--
.../encrypt-digest-functions/xxhash-64.md | 32 ++++++++++++++++++--
12 files changed, 313 insertions(+), 63 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
index 0c512191f1c..dbc4f26fc0d 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
@@ -7,19 +7,19 @@
## description
-Calculates an MD5 128-bit checksum for the string
+Calculates an MD5 128-bit checksum for the string or binary.
## Syntax
```sql
-MD5( <str> )
+MD5( <input> )
```
## Parameters
| parameter | description |
| -- | -- |
-| `<str>` | The MD5 value to be calculated |
+| `<input>` | The MD5 value to be calculated, accept string and binary types |
## Return Value
@@ -28,13 +28,28 @@ Returns the MD5 value of a string.
## Examples
```sql
-select md5("abc");
+-- vb (VarBinary) and vc (VarChar) used the same string during insertion.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
```
-
```text
-+----------------------------------+
-| md5('abc') |
-+----------------------------------+
-| 900150983cd24fb0d6963f7d28e17f72 |
-+----------------------------------+
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
```
+
+```sql
+SELECT MD5(vb), MD5(vc) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++----------------------------------+----------------------------------+
+| MD5(vb) | MD5(vc) |
++----------------------------------+----------------------------------+
+| 900150983cd24fb0d6963f7d28e17f72 | 900150983cd24fb0d6963f7d28e17f72 |
+| d16fb36f0911f878998c136191af705e | d16fb36f0911f878998c136191af705e |
+| NULL | NULL |
++----------------------------------+----------------------------------+
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
index f9c5b77bb0e..f94d76112c5 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
@@ -15,14 +15,14 @@ SHA
## Syntax
``` sql
-SHA1( <str> )
+SHA1( <input> )
```
## Parameters
| parameter | description |
|-----------|-------------|
-| `<str>` | The sha1 value to be calculated |
+| `<input>` | The sha1 value to be calculated, accept string and binary
types |
## Return Value
@@ -32,13 +32,28 @@ Returns the sha1 value of the input string
## Examples
```sql
-select sha("123"), sha1("123");
+-- vb (VarBinary) and vc (VarChar) used the same string during insertion.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
```
+```sql
+SELECT SHA1(vb), SHA1(vc) FROM mysql_catalog.binary_test.binary_test;
+```
```text
+------------------------------------------+------------------------------------------+
-| sha1('123') | sha1('123')
|
+| SHA1(vb) | SHA1(vc)
|
+------------------------------------------+------------------------------------------+
-| 40bd001563085fc35165329ea1ff5c5ecbdbbeef |
40bd001563085fc35165329ea1ff5c5ecbdbbeef |
+| a9993e364706816aba3e25717850c26c9cd0d89d |
a9993e364706816aba3e25717850c26c9cd0d89d |
+| 66b27417d37e024c46526c2f6d358a754fc552f3 |
66b27417d37e024c46526c2f6d358a754fc552f3 |
+| NULL | NULL
|
+------------------------------------------+------------------------------------------+
-```
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
index 5cf54b759dd..4961b2044c4 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
@@ -12,14 +12,14 @@ The information is digested using SHA2.
## Syntax
```sql
-SHA2( <str>, <digest_length>)
+SHA2( <input>, <digest_length>)
```
## Parameters
| parameter | description |
|-------------------|----------------------------|
-| `<str>` | Content to be encrypted |
+| `<input>` | Content to be encrypted, accept string and binary
types |
| `<digest_length>` | Summary length, supports 224, 256, 384, 512. must be
constant |
## Return Value
@@ -63,3 +63,30 @@ select sha2(k0, k1) from str;
```text
ERROR 1105 (HY000): errCode = 2, detailMessage = the second parameter of sha2
must be a literal but got: k1
```
+
+```sql
+-- vb (VarBinary) and vc (VarChar) used the same string during insertion.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
+```
+
+```sql
+SELECT SHA2(vb, 224), SHA2(vc, 224) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++----------------------------------------------------------+----------------------------------------------------------+
+| SHA2(vb, 224) | SHA2(vc, 224)
|
++----------------------------------------------------------+----------------------------------------------------------+
+| 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 |
23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 |
+| 30e90f1cd0ceff8eb3dd6a540a605c0666f841d35de63c57e4dd2877 |
30e90f1cd0ceff8eb3dd6a540a605c0666f841d35de63c57e4dd2877 |
+| NULL | NULL
|
++----------------------------------------------------------+----------------------------------------------------------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
index 00505ec0718..d704fffa4dd 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
@@ -12,7 +12,7 @@ Calculation SM3 256-bit
## Syntax
```sql
-SM3( <str> )
+SM3( <input> )
```
## Parameters
@@ -20,7 +20,7 @@ SM3( <str> )
| parameter | description |
|-----------|-------------|
-| `<str>` | The value of sm3 that needs to be calculated |
+| `<input>` | The value of sm3 that needs to be calculated, accept string
and binary types |
## Return Value
Returns the sm3 value of the input string
@@ -28,13 +28,28 @@ Returns the sm3 value of the input string
## Examples
```sql
-select sm3("abcd");
+-- vb (VarBinary) and vc (VarChar) used the same string during insertion.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
```
-
```text
-+------------------------------------------------------------------+
-| sm3('abcd') |
-+------------------------------------------------------------------+
-| 82ec580fe6d36ae4f81cae3c73f4a5b3b5a09c943172dc9053c69fd8e18dca1e |
-+------------------------------------------------------------------+
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
```
+
+```sql
+SELECT SM3(vb), SM3(vc) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------------------------------------------------------------------+------------------------------------------------------------------+
+| SM3(vb) | SM3(vc)
|
++------------------------------------------------------------------+------------------------------------------------------------------+
+| 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0 |
66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0 |
+| 869fff440724014a7e086c8b3680f4cfc6a3390670f6e7755a4f0c43c1c31db6 |
869fff440724014a7e086c8b3680f4cfc6a3390670f6e7755a4f0c43c1c31db6 |
+| NULL | NULL
|
++------------------------------------------------------------------+------------------------------------------------------------------+
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
index 6854c289f7a..86c412d5140 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
@@ -7,21 +7,21 @@
## Description
-Calculate the 32-bit xxhash value of the input string
+Calculate the 32-bit xxhash value of the input string or binary.
-Note: When calculating hash values, it is recommended to use `xxhash_32`
instead of `murmur_hash3_32`.
## Syntax
```sql
-XXHASH_32( <str> [ , <str> ... ] )
+XXHASH_32( <input> [ , <input> ... ] )
```
## Parameters
| parameter | description |
|-----------|------------------|
-| `<str>` | The 32-bit xxhash value to be calculated |
+| `<input>` | The 32-bit xxhash value to be calculated, accept string and
binary types |
## Return Value
@@ -39,4 +39,31 @@ select xxhash_32(NULL), xxhash_32("hello"),
xxhash_32("hello", "world");
+-----------------+--------------------+-----------------------------+
| NULL | -83855367 | -920844969 |
+-----------------+--------------------+-----------------------------+
+```
+
+```sql
+-- vb (VarBinary) and vc (VarChar) used the same string during insertion.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
+```
+
+```sql
+SELECT XXHASH_32(vb), XXHASH_32(vc) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++---------------+---------------+
+| XXHASH_32(vb) | XXHASH_32(vc) |
++---------------+---------------+
+| 852579327 | 852579327 |
+| -242012205 | -242012205 |
+| NULL | NULL |
++---------------+---------------+
```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
index 671546d1d6f..6f90b6caf3f 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
@@ -7,21 +7,21 @@
## Description
-Calculates the 64-bit xxhash value of the input string
+Calculates the 64-bit xxhash value of the input string or binary.
-Note: After testing, the performance of `xxhash_64` is about twice that of
`murmur_hash3_64`, so when calculating hash values, it is recommended to use
`xxhash_64` instead of `murmur_hash3_64`.
## Syntax
```sql
-XXHASH_64( <str> [ , <str> ... ] )
+XXHASH_64( <input> [ , <input> ... ] )
```
## Parameters
| parameter | description |
|-----------|------------------|
-| `<str>` | The 64-bit xxhash value to be calculated |
+| `<input>` | The 64-bit xxhash value to be calculated, accept string and
binary types |
## Return Value
@@ -39,4 +39,30 @@ select xxhash_64(NULL), xxhash_64("hello"),
xxhash_64("hello", "world");
+-----------------+----------------------+-----------------------------+
| NULL | -7685981735718036227 | 7001965798170371843 |
+-----------------+----------------------+-----------------------------+
+```
+
+```sql
+-- vb (VarBinary) and vc (VarChar) used the same string during insertion.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
+```
+```sql
+SELECT XXHASH_64(vb), XXHASH_64(vc) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++---------------------+---------------------+
+| XXHASH_64(vb) | XXHASH_64(vc) |
++---------------------+---------------------+
+| 8696274497037089104 | 8696274497037089104 |
+| 7095089596068863775 | 7095089596068863775 |
+| NULL | NULL |
++---------------------+---------------------+
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
index 0ea400cce71..d6472e3b4d9 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/md5.md
@@ -12,14 +12,14 @@
## 语法
```sql
-MD5( <str> )
+MD5( <input> )
```
## 参数
| 参数 | 说明 |
|---------| -- |
-| `<str>` | 需要被计算 MD5 的值 |
+| `<input>` | 需要被计算 MD5 的值, 接受字符串和二进制类型 |
## 返回值
返回字符串的 MD5 值。
@@ -27,13 +27,28 @@ MD5( <str> )
## 示例
```sql
-select md5("abc");
+-- vb (VarBinary) 和 vc (VarChar) 插入时使用了相同的字符串.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
```
+```sql
+SELECT MD5(vb), MD5(vc) FROM mysql_catalog.binary_test.binary_test;
+```
```text
-+----------------------------------+
-| md5('abc') |
-+----------------------------------+
-| 900150983cd24fb0d6963f7d28e17f72 |
-+----------------------------------+
++----------------------------------+----------------------------------+
+| MD5(vb) | MD5(vc) |
++----------------------------------+----------------------------------+
+| 900150983cd24fb0d6963f7d28e17f72 | 900150983cd24fb0d6963f7d28e17f72 |
+| d16fb36f0911f878998c136191af705e | d16fb36f0911f878998c136191af705e |
+| NULL | NULL |
++----------------------------------+----------------------------------+
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
index 8422792d924..001eb697879 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha.md
@@ -15,14 +15,14 @@ SHA
## 语法
``` sql
-SHA1( <str> )
+SHA1( <input> )
```
## 参数
| 参数 | 说明 |
|---------|-------------|
-| `<str>` | 需要被计算 sha1 的值 |
+| `<input>` | 需要被计算 sha1 的值, 接受字符串和二进制类型 |
## 返回值
@@ -32,13 +32,28 @@ SHA1( <str> )
## 示例
```sql
-select sha("123"), sha1("123");
+-- vb (VarBinary) 和 vc (VarChar) 插入时使用了相同的字符串.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
```
+```sql
+SELECT SHA1(vb), SHA1(vc) FROM mysql_catalog.binary_test.binary_test;
+```
```text
+------------------------------------------+------------------------------------------+
-| sha1('123') | sha1('123')
|
+| SHA1(vb) | SHA1(vc)
|
+------------------------------------------+------------------------------------------+
-| 40bd001563085fc35165329ea1ff5c5ecbdbbeef |
40bd001563085fc35165329ea1ff5c5ecbdbbeef |
+| a9993e364706816aba3e25717850c26c9cd0d89d |
a9993e364706816aba3e25717850c26c9cd0d89d |
+| 66b27417d37e024c46526c2f6d358a754fc552f3 |
66b27417d37e024c46526c2f6d358a754fc552f3 |
+| NULL | NULL
|
+------------------------------------------+------------------------------------------+
-```
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
index 927a90287b0..143360b95a7 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sha2.md
@@ -12,14 +12,14 @@
## 语法
```sql
-SHA2(<str>, <digest_length>)
+SHA2(<input>, <digest_length>)
```
## 参数
| 参数 | 说明 |
|---------|-------------|
-| `<str>` | 待加密的内容 |
+| `<input>` | 待加密的内容, 接受字符串和二进制类型 |
| `<digest_length>` | 摘要长度,支持 224, 256, 384, 512,必须为常量 |
## 返回值
@@ -63,3 +63,30 @@ select sha2(k0, k1) from str;
```text
ERROR 1105 (HY000): errCode = 2, detailMessage = the second parameter of sha2
must be a literal but got: k1
```
+
+```sql
+-- vb (VarBinary) 和 vc (VarChar) 插入时使用了相同的字符串.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
+```
+
+```sql
+SELECT SHA2(vb, 224), SHA2(vc, 224) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++----------------------------------------------------------+----------------------------------------------------------+
+| SHA2(vb, 224) | SHA2(vc, 224)
|
++----------------------------------------------------------+----------------------------------------------------------+
+| 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 |
23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 |
+| 30e90f1cd0ceff8eb3dd6a540a605c0666f841d35de63c57e4dd2877 |
30e90f1cd0ceff8eb3dd6a540a605c0666f841d35de63c57e4dd2877 |
+| NULL | NULL
|
++----------------------------------------------------------+----------------------------------------------------------+
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
index 2c891e9ba47..93dcee56a44 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/sm3.md
@@ -12,14 +12,14 @@
## 语法
```sql
-SM3( <str> )
+SM3( <input> )
```
## 参数
| 参数 | 说明 |
|---------|------------|
-| `<str>` | 需要被计算 sm3 的值 |
+| `<input>` | 需要被计算 sm3 的值, 接受字符串和二进制类型 |
## 返回值
返回输入字符串的 sm3 值
@@ -27,13 +27,28 @@ SM3( <str> )
## 示例
```sql
-select sm3("abcd");
+-- vb (VarBinary) 和 vc (VarChar) 插入时使用了相同的字符串.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
```
+```sql
+SELECT SM3(vb), SM3(vc) FROM mysql_catalog.binary_test.binary_test;
+```
```text
-+------------------------------------------------------------------+
-| sm3('abcd') |
-+------------------------------------------------------------------+
-| 82ec580fe6d36ae4f81cae3c73f4a5b3b5a09c943172dc9053c69fd8e18dca1e |
-+------------------------------------------------------------------+
++------------------------------------------------------------------+------------------------------------------------------------------+
+| SM3(vb) | SM3(vc)
|
++------------------------------------------------------------------+------------------------------------------------------------------+
+| 66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0 |
66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0 |
+| 869fff440724014a7e086c8b3680f4cfc6a3390670f6e7755a4f0c43c1c31db6 |
869fff440724014a7e086c8b3680f4cfc6a3390670f6e7755a4f0c43c1c31db6 |
+| NULL | NULL
|
++------------------------------------------------------------------+------------------------------------------------------------------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
index a309c1592f1..e474843f3d2 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-32.md
@@ -7,21 +7,21 @@
## 描述
-计算输入字符串的 32 位 xxhash 值
+计算输入字符串或二进制的 32 位 xxhash 值
-注:在计算 hash 值时,更推荐使用`xxhash_32`,而不是`murmur_hash3_32`。
## 语法
```sql
-XXHASH_32( <str> [ , <str> ... ] )
+XXHASH_32( <input> [ , <input> ... ] )
```
## 参数
| 参数 | 说明 |
|---------|------------------|
-| `<str>` | 需要被计算 32 位 xxhash 的值 |
+| `<input>` | 需要被计算 32 位 xxhash 的值, 接受字符串和二进制类型 |
## 返回值
@@ -39,4 +39,31 @@ select xxhash_32(NULL), xxhash_32("hello"),
xxhash_32("hello", "world");
+-----------------+--------------------+-----------------------------+
| NULL | -83855367 | -920844969 |
+-----------------+--------------------+-----------------------------+
+```
+
+```sql
+-- vb (VarBinary) 和 vc (VarChar) 插入时使用了相同的字符串.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
+```
+
+```sql
+SELECT XXHASH_32(vb), XXHASH_32(vc) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++---------------+---------------+
+| XXHASH_32(vb) | XXHASH_32(vc) |
++---------------+---------------+
+| 852579327 | 852579327 |
+| -242012205 | -242012205 |
+| NULL | NULL |
++---------------+---------------+
```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
index b3300a397fe..38bda3bf103 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/encrypt-digest-functions/xxhash-64.md
@@ -7,21 +7,21 @@
## 描述
-计算输入字符串的 64 位 xxhash 值
+计算输入字符串或二进制的 64 位 xxhash 值
-注:经过测试 xxhash_64 的性能大约是 murmur_hash3_64 的 2 倍,所以在计算 hash
值时,更推荐使用`xxhash_64`,而不是`murmur_hash3_64`。
## 语法
```sql
-XXHASH_64( <str> [ , <str> ... ] )
+XXHASH_64( <input> [ , <input> ... ] )
```
## 参数
| 参数 | 说明 |
|---------|------------------|
-| `<str>` | 需要被计算 64 位 xxhash 的值 |
+| `<input>` | 需要被计算 64 位 xxhash 的值, 接受字符串和二进制类型 |
## 返回值
@@ -39,4 +39,30 @@ select xxhash_64(NULL), xxhash_64("hello"),
xxhash_64("hello", "world");
+-----------------+----------------------+-----------------------------+
| NULL | -7685981735718036227 | 7001965798170371843 |
+-----------------+----------------------+-----------------------------+
+```
+
+```sql
+-- vb (VarBinary) 和 vc (VarChar) 插入时使用了相同的字符串.
+SELECT * FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++------+------------+------+
+| id | vb | vc |
++------+------------+------+
+| 1 | 0x616263 | abc |
+| 2 | 0x78797A | xyz |
+| 3 | NULL | NULL |
++------+------------+------+
+```
+```sql
+SELECT XXHASH_64(vb), XXHASH_64(vc) FROM mysql_catalog.binary_test.binary_test;
+```
+```text
++---------------------+---------------------+
+| XXHASH_64(vb) | XXHASH_64(vc) |
++---------------------+---------------------+
+| 8696274497037089104 | 8696274497037089104 |
+| 7095089596068863775 | 7095089596068863775 |
+| NULL | NULL |
++---------------------+---------------------+
```
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]