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 d3aa13b5bcd Quantile serias scalar function (#2055)
d3aa13b5bcd is described below

commit d3aa13b5bcd4a8e42d1cf01da72b1128e5c9e6b4
Author: zhiqiang <[email protected]>
AuthorDate: Mon Mar 3 10:06:11 2025 +0800

    Quantile serias scalar function (#2055)
    
    ## Versions
    
    - [ ] dev
    - [ ] 3.0
    - [ ] 2.1
    - [ ] 2.0
    
    ## Languages
    
    - [ ] Chinese
    - [ ] English
    
    ## Docs Checklist
    
    - [ ] Checked by AI
    - [ ] Test Cases Built
---
 .../quantile-functions/quantile-percent.md         | 52 +++++++++++++++++++++
 .../quantile-functions/quantile-state-empty.md     | 30 +++++++++++-
 .../quantile-functions/to-quantile-state.md        | 53 +++++++++++++++++++++
 .../quantile-functions/quantile-percent.md         | 54 ++++++++++++++++++++++
 .../quantile-functions/quantile-state-empty.md     | 30 +++++++++++-
 .../quantile-functions/to-quantile-state.md        | 53 +++++++++++++++++++++
 .../quantile-functions/quantile-percent.md         | 52 +++++++++++++++++++++
 .../quantile-functions/quantile-state-empty.md     | 30 +++++++++++-
 .../quantile-functions/to-quantile-state.md        | 53 +++++++++++++++++++++
 .../quantile-functions/quantile-percent.md         | 52 +++++++++++++++++++++
 .../quantile-functions/quantile-state-empty.md     | 30 +++++++++++-
 .../quantile-functions/to-quantile-state.md        | 53 +++++++++++++++++++++
 .../quantile-functions/quantile-percent.md         | 52 +++++++++++++++++++++
 .../quantile-functions/quantile-state-empty.md     | 30 +++++++++++-
 .../quantile-functions/to-quantile-state.md        | 53 +++++++++++++++++++++
 .../quantile-functions/quantile-percent.md         | 49 ++++++++++++++++++++
 .../quantile-functions/quantile-state-empty.md     | 30 +++++++++++-
 .../quantile-functions/to-quantile-state.md        | 53 +++++++++++++++++++++
 18 files changed, 803 insertions(+), 6 deletions(-)

diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
 
b/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
index a209c153e06..e619a4deceb 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
@@ -22,4 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+The `QUANTILE_PERCENT` function is used to calculate the quantile value for a 
given percentage. It takes two parameters: a quantile_state column and a 
constant floating-point number representing the percentage. The function 
returns a floating-point number that represents the quantile value at the given 
percentage position.
+
+## Syntax
+
+```sql
+QUANTILE_PERCENT(<quantile_state>, <percent>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<quantile_state>` | The target column.|
+| `<percent>` | Target percent.|
+
+## Return value
+
+A `Double` type to represent quantile.
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+Result is 
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
 
b/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
index a209c153e06..711425caffb 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
@@ -1,6 +1,6 @@
 ---
 {
-    "title": "quantile_percent",
+    "title": "quantile_state_empty",
     "language": "en"
 }
 ---
@@ -22,4 +22,32 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+Return an empty `quantile_state` type column.
+
+## Syntax
+
+```sql
+QUANTILE_STATE_EMPTY()
+```
+
+## Return value
+
+An empty `quantile_state` type column.
+
+## Example
+
+```sql
+select quantile_percent(quantile_union(quantile_state_empty()), 0)
+```
+
+Result is 
+
+```text
++-------------------------------------------------------------+
+| quantile_percent(quantile_union(quantile_state_empty()), 0) |
++-------------------------------------------------------------+
+|                                                        NULL |
++-------------------------------------------------------------+
+```
diff --git 
a/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
 
b/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
index d1359f0015c..899b25a82ad 100644
--- 
a/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
+++ 
b/docs/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
@@ -22,3 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
+
+This function converts numeric types to `QUANTILE_STATE` type. The compression 
parameter is optional and can be set in the range [2048, 10000]. The larger the 
value, the higher the accuracy of subsequent quantile approximation 
calculations, the greater the memory consumption, and the longer the 
calculation time. If the compression parameter is not specified or the value is 
set outside the range [2048, 10000], it runs with the default value of 2048.
+
+## Syntax
+
+```sql
+TO_QUANTILE_STATE(<raw_data> <compression>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<raw_data>` | The target column.|
+| `<compression>` | Compression threshold.|
+
+## Return value
+
+The converted column of `QUANTILE_STATE` type.
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+Result is
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
index b2670c9fc61..397abb041df 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
@@ -22,4 +22,58 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
+
+`QUANTILE_PERCENT` 函数用于计算给定百分比的分位数值。它接受两个参数:一个 quantile_state 
列和一个表示百分比的常量浮点数。该函数返回一个浮点数,表示给定百分比位置的分位数值。
+
+## Syntax
+
+```sql
+QUANTILE_PERCENT(<quantile_state>, <percent>)
+```
+
+## Parameters
+
+| 参数 | 描述 |
+| -- | -- |
+| `<quantile_state>` | 目标列。|
+| `<percent>` | 目标百分比。|
+
+## Return value
+
+返回一个 `Double` 类型的分位数值。
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+结果为
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
+
 
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
index b2670c9fc61..a399ac4f410 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
@@ -1,6 +1,6 @@
 ---
 {
-    "title": "quantile_percent",
+    "title": "quantile_state_empty",
     "language": "zh-CN"
 }
 ---
@@ -22,4 +22,32 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+返回一个空的 `quantile_state` 类型列。
+
+## Syntax
+
+```sql
+QUANTILE_STATE_EMPTY()
+```
+
+## Return value
+
+一个空的 `quantile_state` 类型列。
+
+## Example
+
+```sql
+select quantile_percent(quantile_union(quantile_state_empty()), 0)
+```
+
+结果为
+
+```text
++-------------------------------------------------------------+
+| quantile_percent(quantile_union(quantile_state_empty()), 0) |
++-------------------------------------------------------------+
+|                                                        NULL |
++-------------------------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
index 01a40b7a44f..96d92e810e1 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
@@ -22,3 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
+
+此函数将数值类型转化成 `QUANTILE_STATE` 类型。 compression 参数是可选项,可设置范围是[2048, 
10000],值越大,后续分位数近似计算的精度越高,内存消耗越大,计算耗时越长。 compression 参数未指定或设置的值在[2048, 
10000]范围外,以 2048 的默认值运行
+
+## Syntax
+
+```sql
+TO_QUANTILE_STATE(<raw_data> <compression>)
+```
+
+## Parameters
+
+| 参数 | 描述 |
+| -- | -- |
+| `<raw_data>` | 目标列。|
+| `<compression>` | 压缩阈值。|
+
+## Return value
+
+转换之后的 `QUANTILE_STATE` 类型的列。
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS ${tableName_21} (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+结果为
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
index b2670c9fc61..6f6dda1eecd 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
@@ -22,4 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+`QUANTILE_PERCENT` 函数用于计算给定百分比的分位数值。它接受两个参数:一个 quantile_state 
列和一个表示百分比的常量浮点数。该函数返回一个浮点数,表示给定百分比位置的分位数值。
+
+## Syntax
+
+```sql
+QUANTILE_PERCENT(<quantile_state>, <percent>)
+```
+
+## Parameters
+
+| 参数 | 描述 |
+| -- | -- |
+| `<quantile_state>` | 目标列。|
+| `<percent>` | 目标百分比。|
+
+## Return value
+
+返回一个 `Double` 类型的分位数值。
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+结果为
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
index b2670c9fc61..a399ac4f410 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
@@ -1,6 +1,6 @@
 ---
 {
-    "title": "quantile_percent",
+    "title": "quantile_state_empty",
     "language": "zh-CN"
 }
 ---
@@ -22,4 +22,32 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+返回一个空的 `quantile_state` 类型列。
+
+## Syntax
+
+```sql
+QUANTILE_STATE_EMPTY()
+```
+
+## Return value
+
+一个空的 `quantile_state` 类型列。
+
+## Example
+
+```sql
+select quantile_percent(quantile_union(quantile_state_empty()), 0)
+```
+
+结果为
+
+```text
++-------------------------------------------------------------+
+| quantile_percent(quantile_union(quantile_state_empty()), 0) |
++-------------------------------------------------------------+
+|                                                        NULL |
++-------------------------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
index 01a40b7a44f..96d92e810e1 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
@@ -22,3 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
+
+此函数将数值类型转化成 `QUANTILE_STATE` 类型。 compression 参数是可选项,可设置范围是[2048, 
10000],值越大,后续分位数近似计算的精度越高,内存消耗越大,计算耗时越长。 compression 参数未指定或设置的值在[2048, 
10000]范围外,以 2048 的默认值运行
+
+## Syntax
+
+```sql
+TO_QUANTILE_STATE(<raw_data> <compression>)
+```
+
+## Parameters
+
+| 参数 | 描述 |
+| -- | -- |
+| `<raw_data>` | 目标列。|
+| `<compression>` | 压缩阈值。|
+
+## Return value
+
+转换之后的 `QUANTILE_STATE` 类型的列。
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS ${tableName_21} (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+结果为
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
index b2670c9fc61..6f6dda1eecd 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
@@ -22,4 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+`QUANTILE_PERCENT` 函数用于计算给定百分比的分位数值。它接受两个参数:一个 quantile_state 
列和一个表示百分比的常量浮点数。该函数返回一个浮点数,表示给定百分比位置的分位数值。
+
+## Syntax
+
+```sql
+QUANTILE_PERCENT(<quantile_state>, <percent>)
+```
+
+## Parameters
+
+| 参数 | 描述 |
+| -- | -- |
+| `<quantile_state>` | 目标列。|
+| `<percent>` | 目标百分比。|
+
+## Return value
+
+返回一个 `Double` 类型的分位数值。
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+结果为
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
index b2670c9fc61..a399ac4f410 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
@@ -1,6 +1,6 @@
 ---
 {
-    "title": "quantile_percent",
+    "title": "quantile_state_empty",
     "language": "zh-CN"
 }
 ---
@@ -22,4 +22,32 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+返回一个空的 `quantile_state` 类型列。
+
+## Syntax
+
+```sql
+QUANTILE_STATE_EMPTY()
+```
+
+## Return value
+
+一个空的 `quantile_state` 类型列。
+
+## Example
+
+```sql
+select quantile_percent(quantile_union(quantile_state_empty()), 0)
+```
+
+结果为
+
+```text
++-------------------------------------------------------------+
+| quantile_percent(quantile_union(quantile_state_empty()), 0) |
++-------------------------------------------------------------+
+|                                                        NULL |
++-------------------------------------------------------------+
+```
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
index 01a40b7a44f..96d92e810e1 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
@@ -22,3 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
+
+此函数将数值类型转化成 `QUANTILE_STATE` 类型。 compression 参数是可选项,可设置范围是[2048, 
10000],值越大,后续分位数近似计算的精度越高,内存消耗越大,计算耗时越长。 compression 参数未指定或设置的值在[2048, 
10000]范围外,以 2048 的默认值运行
+
+## Syntax
+
+```sql
+TO_QUANTILE_STATE(<raw_data> <compression>)
+```
+
+## Parameters
+
+| 参数 | 描述 |
+| -- | -- |
+| `<raw_data>` | 目标列。|
+| `<compression>` | 压缩阈值。|
+
+## Return value
+
+转换之后的 `QUANTILE_STATE` 类型的列。
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS ${tableName_21} (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+结果为
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
index a209c153e06..e619a4deceb 100644
--- 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
+++ 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
@@ -22,4 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+The `QUANTILE_PERCENT` function is used to calculate the quantile value for a 
given percentage. It takes two parameters: a quantile_state column and a 
constant floating-point number representing the percentage. The function 
returns a floating-point number that represents the quantile value at the given 
percentage position.
+
+## Syntax
+
+```sql
+QUANTILE_PERCENT(<quantile_state>, <percent>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<quantile_state>` | The target column.|
+| `<percent>` | Target percent.|
+
+## Return value
+
+A `Double` type to represent quantile.
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+Result is 
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
index a209c153e06..711425caffb 100644
--- 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
+++ 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
@@ -1,6 +1,6 @@
 ---
 {
-    "title": "quantile_percent",
+    "title": "quantile_state_empty",
     "language": "en"
 }
 ---
@@ -22,4 +22,32 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+Return an empty `quantile_state` type column.
+
+## Syntax
+
+```sql
+QUANTILE_STATE_EMPTY()
+```
+
+## Return value
+
+An empty `quantile_state` type column.
+
+## Example
+
+```sql
+select quantile_percent(quantile_union(quantile_state_empty()), 0)
+```
+
+Result is 
+
+```text
++-------------------------------------------------------------+
+| quantile_percent(quantile_union(quantile_state_empty()), 0) |
++-------------------------------------------------------------+
+|                                                        NULL |
++-------------------------------------------------------------+
+```
diff --git 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
index d1359f0015c..899b25a82ad 100644
--- 
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
+++ 
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
@@ -22,3 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
+
+This function converts numeric types to `QUANTILE_STATE` type. The compression 
parameter is optional and can be set in the range [2048, 10000]. The larger the 
value, the higher the accuracy of subsequent quantile approximation 
calculations, the greater the memory consumption, and the longer the 
calculation time. If the compression parameter is not specified or the value is 
set outside the range [2048, 10000], it runs with the default value of 2048.
+
+## Syntax
+
+```sql
+TO_QUANTILE_STATE(<raw_data> <compression>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<raw_data>` | The target column.|
+| `<compression>` | Compression threshold.|
+
+## Return value
+
+The converted column of `QUANTILE_STATE` type.
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+Result is
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
index a209c153e06..99980e1e139 100644
--- 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-percent.md
@@ -22,4 +22,53 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+The `QUANTILE_PERCENT` function is used to calculate the quantile value for a 
given percentage. It takes two parameters: a quantile_state column and a 
constant floating-point number representing the percentage. The function 
returns a floating-point number that represents the quantile value at the given 
percentage position.
+
+## Syntax
+
+```sql
+QUANTILE_PERCENT(<quantile_state>, <percent>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<quantile_state>` | The target column.|
+| `<percent>` | Target percent.|
+
+## Return value
+
+A `Double` type to represent quantile.
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS ${tableName_21} (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+--------------
+
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
index a209c153e06..711425caffb 100644
--- 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/quantile-state-empty.md
@@ -1,6 +1,6 @@
 ---
 {
-    "title": "quantile_percent",
+    "title": "quantile_state_empty",
     "language": "en"
 }
 ---
@@ -22,4 +22,32 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
 
+Return an empty `quantile_state` type column.
+
+## Syntax
+
+```sql
+QUANTILE_STATE_EMPTY()
+```
+
+## Return value
+
+An empty `quantile_state` type column.
+
+## Example
+
+```sql
+select quantile_percent(quantile_union(quantile_state_empty()), 0)
+```
+
+Result is 
+
+```text
++-------------------------------------------------------------+
+| quantile_percent(quantile_union(quantile_state_empty()), 0) |
++-------------------------------------------------------------+
+|                                                        NULL |
++-------------------------------------------------------------+
+```
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
index d1359f0015c..899b25a82ad 100644
--- 
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/quantile-functions/to-quantile-state.md
@@ -22,3 +22,56 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+## Description
+
+This function converts numeric types to `QUANTILE_STATE` type. The compression 
parameter is optional and can be set in the range [2048, 10000]. The larger the 
value, the higher the accuracy of subsequent quantile approximation 
calculations, the greater the memory consumption, and the longer the 
calculation time. If the compression parameter is not specified or the value is 
set outside the range [2048, 10000], it runs with the default value of 2048.
+
+## Syntax
+
+```sql
+TO_QUANTILE_STATE(<raw_data> <compression>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<raw_data>` | The target column.|
+| `<compression>` | Compression threshold.|
+
+## Return value
+
+The converted column of `QUANTILE_STATE` type.
+
+## Example
+
+```sql
+CREATE TABLE IF NOT EXISTS quantile_state_agg_test (
+         `dt` int(11) NULL COMMENT "",
+         `id` int(11) NULL COMMENT "",
+         `price` quantile_state QUANTILE_UNION NOT NULL COMMENT ""
+        ) ENGINE=OLAP
+        AGGREGATE KEY(`dt`, `id`)
+        COMMENT "OLAP"
+        DISTRIBUTED BY HASH(`dt`) BUCKETS 1
+        PROPERTIES ("replication_num" = "1");
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,0, to_quantile_state(1, 
2048));
+
+INSERT INTO quantile_state_agg_test VALUES(20220201,1, to_quantile_state(-1, 
2048)),
+            (20220201,1, to_quantile_state(0, 2048)),(20220201,1, 
to_quantile_state(1, 2048)),
+            (20220201,1, to_quantile_state(2, 2048)),(20220201,1, 
to_quantile_state(3, 2048));
+
+SELECT dt, id, quantile_percent(quantile_union(price), 0) FROM 
quantile_state_agg_test GROUP BY dt, id ORDER BY dt, id
+```
+
+Result is
+
+```text
++----------+------+--------------------------------------------+
+| dt       | id   | quantile_percent(quantile_union(price), 0) |
++----------+------+--------------------------------------------+
+| 20220201 |    0 |                                          1 |
+| 20220201 |    1 |                                         -1 |
++----------+------+--------------------------------------------+
+```


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


Reply via email to