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 80bd25d73ee [doc] (function) add docs for factorial (#3071)
80bd25d73ee is described below

commit 80bd25d73eed4ce79c5910db5e4e59ab8b54ea2a
Author: K_handle_Y <[email protected]>
AuthorDate: Tue Nov 11 09:28:30 2025 +0800

    [doc] (function) add docs for factorial (#3071)
    
    ## Versions
    
    - [x] dev
    - [ ] 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 ++++++++++++++++++++++
 sidebars.ts                                        |  5 +-
 3 files changed, 191 insertions(+), 2 deletions(-)

diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md 
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
new file mode 100644
index 00000000000..fdbcafad722
--- /dev/null
+++ 
b/docs/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/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/factorial.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/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/current/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/sidebars.ts b/sidebars.ts
index e5aa4dcb023..1fa73dc08d7 100644
--- a/sidebars.ts
+++ b/sidebars.ts
@@ -1204,6 +1204,7 @@ const sidebars: SidebarsConfig = {
                                         
'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',
@@ -2468,8 +2469,8 @@ const sidebars: SidebarsConfig = {
                     type: 'category',
                     label: 'v3.1',
                     items: [
-                        'releasenotes/v3.1/release-3.1.2', 
-                        'releasenotes/v3.1/release-3.1.1', 
+                        'releasenotes/v3.1/release-3.1.2',
+                        'releasenotes/v3.1/release-3.1.1',
                         'releasenotes/v3.1/release-3.1.0'
                     ],
                 },


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

Reply via email to