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

zclll 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 f77a1942bc5 [doc] (function) add 4.x docs for factorial (#3093)
f77a1942bc5 is described below

commit f77a1942bc55a59497dbe424741d3a2cf501866c
Author: K_handle_Y <[email protected]>
AuthorDate: Thu Nov 13 18:14:55 2025 +0800

    [doc] (function) add 4.x docs for factorial (#3093)
    
    ## Versions
    
    - [ ] dev
    - [x] 4.x
    - [ ] 3.x
    - [ ] 2.1
    
    ## Languages
    
    - [x] Chinese
    - [x] English
    
    ## Docs Checklist
    
    - [ ] Checked by AI
    - [ ] Test Cases Built
---
 .../numeric-functions/factorial.md                 | 94 ++++++++++++++++++++++
 .../numeric-functions/factorial.md                 | 94 ++++++++++++++++++++++
 versioned_sidebars/version-4.x-sidebars.json       |  1 +
 3 files changed, 189 insertions(+)

diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
new file mode 100644
index 00000000000..ee1dda032b4
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
@@ -0,0 +1,94 @@
+---
+{
+    "title": "FACTORIAL",
+    "language": "zh-CN"
+}
+---
+
+## 描述
+
+返回`x`的阶乘值。如果`x`不在`0`到`20`之间 (包括`0`和`20`),则返回`NULL`。
+
+## 语法
+
+```sql
+FACTORIAL(<x>)
+```
+
+## 参数
+
+| 参数 | 描述 |  
+| -- | -- |  
+| `<x>` | 需要计算阶乘值的数值 |  
+
+## 返回值
+
+参数`x`的阶乘值。
+
+## 特殊情况处理
+
+- 当 `x` 等于 0 时,返回 1
+- 当 `x` 超出 [0, 20] 范围时,返回 `NULL`
+- 当 `x` 为 NULL 时,返回 NULL
+
+## 示例
+
+```sql
+select factorial(0);
+```
+
+```text
++--------------+
+| factorial(0) |
++--------------+
+|            1 |
++--------------+
+```
+
+```sql
+select factorial(-1);
+```
+
+```text
++---------------+
+| factorial(-1) |
++---------------+
+|          NULL |
++---------------+
+```
+
+```sql
+select factorial(21);
+```
+
+```text
++---------------+
+| factorial(21) |
++---------------+
+|          NULL |
++---------------+
+```
+
+```sql
+select factorial(20);
+```
+
+```text
++---------------------+
+| factorial(20)       |
++---------------------+
+| 2432902008176640000 |
++---------------------+
+```
+
+```sql
+select factorial(NULL);
+```
+
+```text
++-----------------+
+| factorial(NULL) |
++-----------------+
+|            NULL |
++-----------------+
+```
diff --git 
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
new file mode 100644
index 00000000000..fdbcafad722
--- /dev/null
+++ 
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
@@ -0,0 +1,94 @@
+---
+{
+    "title": "FACTORIAL",
+    "language": "en"
+}
+---
+
+## Description
+
+Returns the factorial of `x`, or `NULL` if `x` is not in the range `0` to `20` 
(including `0` and `20`).
+
+## Syntax
+
+```sql
+FACTORIAL(<x>)
+```
+
+## Parameters
+
+| Parameter | Description |  
+| -- | -- |  
+| `<x>` | The value for which the factorial is to be calculated |  
+
+## Return Value  
+
+The factorial value of parameter `x`.
+
+## Special Cases
+
+- When `x` equals 0, returns 1
+- When `x` is not in the range [0, 20], returns `NULL`
+- When `x` is NULL, returns NULL
+
+## Examples
+
+```sql
+select factorial(0);
+```
+
+```text
++--------------+
+| factorial(0) |
++--------------+
+|            1 |
++--------------+
+```
+
+```sql
+select factorial(-1);
+```
+
+```text
++---------------+
+| factorial(-1) |
++---------------+
+|          NULL |
++---------------+
+```
+
+```sql
+select factorial(21);
+```
+
+```text
++---------------+
+| factorial(21) |
++---------------+
+|          NULL |
++---------------+
+```
+
+```sql
+select factorial(20);
+```
+
+```text
++---------------------+
+| factorial(20)       |
++---------------------+
+| 2432902008176640000 |
++---------------------+
+```
+
+```sql
+select factorial(NULL);
+```
+
+```text
++-----------------+
+| factorial(NULL) |
++-----------------+
+|            NULL |
++-----------------+
+```
diff --git a/versioned_sidebars/version-4.x-sidebars.json 
b/versioned_sidebars/version-4.x-sidebars.json
index f593f4c36c5..6ddbb70d12a 100644
--- a/versioned_sidebars/version-4.x-sidebars.json
+++ b/versioned_sidebars/version-4.x-sidebars.json
@@ -1229,6 +1229,7 @@
                                         
"sql-manual/sql-functions/scalar-functions/numeric-functions/degrees",
                                         
"sql-manual/sql-functions/scalar-functions/numeric-functions/e",
                                         
"sql-manual/sql-functions/scalar-functions/numeric-functions/exp",
+                                        
"sql-manual/sql-functions/scalar-functions/numeric-functions/factorial",
                                         
"sql-manual/sql-functions/scalar-functions/numeric-functions/floor",
                                         
"sql-manual/sql-functions/scalar-functions/numeric-functions/fmod",
                                         
"sql-manual/sql-functions/scalar-functions/numeric-functions/format-round",


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

Reply via email to