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 af5b73bf41a [Fix](function) Add lost check of function SHA2 in nereids 
(#2406)
af5b73bf41a is described below

commit af5b73bf41a6a0257f6337112c72d8b7b46777ab
Author: zclllyybb <[email protected]>
AuthorDate: Sat May 24 09:23:41 2025 +0800

    [Fix](function) Add lost check of function SHA2 in nereids (#2406)
    
    ## 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/sha2.md               | 30 ++++++++++++++++++--
 .../encrypt-digest-functions/sha2.md               | 32 +++++++++++++++++++---
 2 files changed, 55 insertions(+), 7 deletions(-)

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 c178ecb4f02..0fe4fdfb144 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
@@ -37,10 +37,10 @@ SHA2( <str>, <digest_length>)
 | parameter         | description                |
 |-------------------|----------------------------|
 | `<str>`           | Content to be encrypted                     |
-| `<digest_length>` | Summary length, supports 224, 256, 384, 512 |
-
+| `<digest_length>` | Summary length, supports 224, 256, 384, 512. must be 
constant |
 
 ## Return Value
+
 Returns the sha2 value of the input string
 
 ## Examples
@@ -55,4 +55,28 @@ select sha2('abc', 224), sha2('abc', 384), sha2(NULL, 512);
 
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------+
 | 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 | 
cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7
 | NULL            |
 
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------+
-```
\ No newline at end of file
+```
+
+```SQL
+select sha2('abc', 225);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = sha2 functions only support 
digest length of [224, 256, 384, 512]
+```
+
+```SQL
+select sha2('str', k1) from str;
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = the second parameter of sha2 
must be a literal but got: k1
+```
+
+```SQL
+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
+```
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 5e2664a0e55..b594c04a070 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
@@ -29,7 +29,7 @@ under the License.
 ## 语法
 
 ```sql
-SHA2( <str>, <digest_length>)
+SHA2(<str>, <digest_length>)
 ```
 
 ## 参数
@@ -37,10 +37,10 @@ SHA2( <str>, <digest_length>)
 | 参数      | 说明          |
 |---------|-------------|
 | `<str>` | 待加密的内容 |
-| `<digest_length>` | 摘要长度,支持 224, 256, 384, 512 |
-
+| `<digest_length>` | 摘要长度,支持 224, 256, 384, 512,必须为常量 |
 
 ## 返回值
+
 返回输入字符串的 sha2 值
 
 ## 示例
@@ -55,4 +55,28 @@ select sha2('abc', 224), sha2('abc', 384), sha2(NULL, 512);
 
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------+
 | 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 | 
cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7
 | NULL            |
 
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------+
-```
\ No newline at end of file
+```
+
+```SQL
+select sha2('abc', 225);
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = sha2 functions only support 
digest length of [224, 256, 384, 512]
+```
+
+```SQL
+select sha2('str', k1) from str;
+```
+
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = the second parameter of sha2 
must be a literal but got: k1
+```
+
+```SQL
+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
+```


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

Reply via email to