update array-agg/collect-list/collect-set/group-array-intersect/group-bitmap-xor/intersect-count/map-agg
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/array-agg.md b/docs/sql-manual/sql-functions/aggregate-functions/array-agg.md
index 3e8d213..b467c11 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/array-agg.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/array-agg.md
@@ -19,7 +19,7 @@
| Parameter | Description |
| -- | -- |
-| `<col>` | An expression that determines the values to be placed into the array (usually column names). |
+| `<col>` | An expression that determines the values to be placed into the array. Supported types: Bool, TinyInt, SmallInt, Integer, BigInt, LargeInt, Float, Double, Decimal, Date, Datetime, IPV4, IPV6, String, Array, Map, Struct. |
## Return Value
@@ -32,27 +32,13 @@
## Example
```sql
-select * from test_doris_array_agg;
-```
-
-```text
-+------+------+
-
-| c1 | c2 |
-
-+------+------+
-
-| 1 | a |
-
-| 1 | b |
-
-| 2 | c |
-
-| 2 | NULL |
-
-| 3 | NULL |
-
-+------+------+
+-- setup
+CREATE TABLE test_doris_array_agg (
+ c1 INT,
+ c2 INT
+) DISTRIBUTED BY HASH(c1) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO test_doris_array_agg VALUES (1, 10), (1, 20), (1, 30), (2, 100), (2, 200), (3, NULL);
```
```sql
@@ -60,18 +46,26 @@
```
```text
-+------+-----------------+
++------+---------------+
+| c1 | array_agg(c2) |
++------+---------------+
+| 1 | [10, 20, 30] |
+| 2 | [100, 200] |
+| 3 | [null] |
++------+---------------+
+```
-| c1 | array_agg(`c2`) |
+```sql
+select array_agg(c2) from test_doris_array_agg where c1 is null;
+```
-+------+-----------------+
-
+```text
++---------------+
+| array_agg(c2) |
++---------------+
+| [] |
++---------------+
+```
| 1 | ["a","b"] |
-| 2 | [NULL,"c"] |
-
-| 3 | [NULL] |
-
-+------+-----------------+
-```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/collect-list.md b/docs/sql-manual/sql-functions/aggregate-functions/collect-list.md
index 56a08e8..014e2da 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/collect-list.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/collect-list.md
@@ -23,33 +23,24 @@
| Parameter | Description |
| -- | -- |
-| `<expr>` | Column or expression to aggregate |
-| `<max_size>` | Optional parameter that can be set to limit the size of the resulting array to max_size elements |
+| `<expr>` | An expression to determine the values to be placed into the array. Supported types: Bool, TinyInt, SmallInt, Integer, BigInt, LargeInt, Float, Double, Decimal, Date, Datetime, IPV4, IPV6, String, Array, Map, Struct. |
+| `<max_size>` | Optional parameter to limit the result array size to max_size elements. Supported type: Integer. |
## Return Value
-The return type is ARRAY, which contains all values. Special circumstances:
-
-- If the value is NULL, it will filter
+Returns ARRAY type, containing all non-NULL values. If there is no valid data in the group, returns an empty array.
## Example
```sql
-select k1,k2,k3 from collect_list_test order by k1;
-```
-
-```text
-+------+------------+-------+
-| k1 | k2 | k3 |
-+------+------------+-------+
-| 1 | 2023-01-01 | hello |
-| 2 | 2023-01-02 | NULL |
-| 2 | 2023-01-02 | hello |
-| 3 | NULL | world |
-| 3 | 2023-01-02 | hello |
-| 4 | 2023-01-02 | sql |
-| 4 | 2023-01-03 | sql |
-+------+------------+-------+
+-- setup
+CREATE TABLE collect_list_test (
+ k1 INT,
+ k2 INT,
+ k3 STRING
+) DISTRIBUTED BY HASH(k1) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO collect_list_test VALUES (1, 10, 'a'), (1, 20, 'b'), (1, 30, 'c'), (2, 100, 'x'), (2, 200, 'y'), (3, NULL, NULL);
```
```sql
@@ -57,11 +48,11 @@
```
```text
-+-------------------------+--------------------------+
-| collect_list(`k1`) | collect_list(`k1`,3) |
-+-------------------------+--------------------------+
-| [1,2,2,3,3,4,4] | [1,2,2] |
-+-------------------------+--------------------------+
++--------------------+--------------------+
+| collect_list(k1) | collect_list(k1,3) |
++--------------------+--------------------+
+| [1, 1, 1, 2, 2, 3] | [1, 1, 1] |
++--------------------+--------------------+
```
```sql
@@ -69,12 +60,11 @@
```
```text
-+------+-------------------------+--------------------------+
-| k1 | collect_list(`k2`) | collect_list(`k3`,1) |
-+------+-------------------------+--------------------------+
-| 1 | [2023-01-01] | [hello] |
-| 2 | [2023-01-02,2023-01-02] | [hello] |
-| 3 | [2023-01-02] | [world] |
-| 4 | [2023-01-02,2023-01-03] | [sql] |
-+------+-------------------------+--------------------------+
++------+------------------+--------------------+
+| k1 | collect_list(k2) | collect_list(k3,1) |
++------+------------------+--------------------+
+| 1 | [10, 20, 30] | ["a"] |
+| 2 | [100, 200] | ["x"] |
+| 3 | [] | [] |
++------+------------------+--------------------+
```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/collect-set.md b/docs/sql-manual/sql-functions/aggregate-functions/collect-set.md
index 6540ff1..8ba70db 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/collect-set.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/collect-set.md
@@ -23,33 +23,24 @@
| Parameter | Description |
| -- | -- |
-| `<expr>` | Column or expression to aggregate |
-| `<max_size>` | Optional parameter that can be set to limit the size of the resulting array to max_size elements |
+| `<expr>` | An expression to determine the values to be placed into the array. Supported types: Bool, TinyInt, SmallInt, Integer, BigInt, LargeInt, Float, Double, Decimal, Date, Datetime, IPV4, IPV6, String, Array, Map, Struct. |
+| `<max_size>` | Optional parameter to limit the result array size to max_size elements. Supported type: Integer. |
## Return Value
-The return type is ARRAY. This array contains all values after deduplication. Special case:
-
-- If the value is NULL, it will filter
+Returns ARRAY type, containing all non-NULL values after deduplication. If there is no valid data in the group, returns an empty array.
## Example
```sql
-select k1,k2,k3 from collect_set_test order by k1;
-```
-
-```text
-+------+------------+-------+
-| k1 | k2 | k3 |
-+------+------------+-------+
-| 1 | 2023-01-01 | hello |
-| 2 | 2023-01-01 | NULL |
-| 2 | 2023-01-02 | hello |
-| 3 | NULL | world |
-| 3 | 2023-01-02 | hello |
-| 4 | 2023-01-02 | doris |
-| 4 | 2023-01-03 | sql |
-+------+------------+-------+
+-- setup
+CREATE TABLE collect_set_test (
+ k1 INT,
+ k2 INT,
+ k3 STRING
+) DISTRIBUTED BY HASH(k1) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO collect_set_test VALUES (1, 10, 'a'), (1, 20, 'b'), (1, 10, 'a'), (2, 100, 'x'), (2, 200, 'y'), (3, NULL, NULL);
```
```sql
@@ -57,11 +48,11 @@
```
```text
-+-------------------------+--------------------------+
-| collect_set(`k1`) | collect_set(`k1`,2) |
-+-------------------------+--------------------------+
-| [4,3,2,1] | [1,2] |
-+----------------------------------------------------+
++-----------------+-------------------+
+| collect_set(k1) | collect_set(k1,2) |
++-----------------+-------------------+
+| [2, 1, 3] | [2, 1] |
++-----------------+-------------------+
```
```sql
@@ -69,12 +60,11 @@
```
```text
-+------+-------------------------+--------------------------+
-| k1 | collect_set(`k2`) | collect_set(`k3`,1) |
-+------+-------------------------+--------------------------+
-| 1 | [2023-01-01] | [hello] |
-| 2 | [2023-01-01,2023-01-02] | [hello] |
-| 3 | [2023-01-02] | [world] |
-| 4 | [2023-01-02,2023-01-03] | [sql] |
-+------+-------------------------+--------------------------+
++------+-----------------+-------------------+
+| k1 | collect_set(k2) | collect_set(k3,1) |
++------+-----------------+-------------------+
+| 1 | [20, 10] | ["a"] |
+| 2 | [200, 100] | ["x"] |
+| 3 | [] | [] |
++------+-----------------+-------------------+
```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md b/docs/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md
index 7db1cab..6818614 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md
@@ -19,37 +19,48 @@
| Parameter | Description |
| -- | -- |
-| `<expr>` | Array columns or array values that require intersection |
+| `<expr>` | An expression to calculate intersection, supported type: Array. |
## Return Value
-Returns an array containing the intersection results
+Returns an array containing the intersection results. If there is no valid data in the group, returns an empty array.
## Example
```sql
-select c_array_string from group_array_intersect_test where id in (18, 20);
-```
-
-```text
-+------+---------------------------+
-| id | col |
-+------+---------------------------+
-| 1 | ["a", "b", "c", "d", "e"] |
-| 2 | ["a", "b"] |
-| 3 | ["a", null] |
-+------+---------------------------+
+-- setup
+CREATE TABLE group_array_intersect_test (
+ id INT,
+ c_array_string ARRAY<STRING>
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO group_array_intersect_test VALUES
+ (1, ['a', 'b', 'c', 'd', 'e']),
+ (2, ['a', 'b']),
+ (3, ['a', null]);
```
```sql
-select group_array_intersect(col) from group_array_intersect_test;
+select group_array_intersect(c_array_string) from group_array_intersect_test;
```
```text
-+----------------------------+
-| group_array_intersect(col) |
-+----------------------------+
-| ["a"] |
-+----------------------------+
++---------------------------------------+
+| group_array_intersect(c_array_string) |
++---------------------------------------+
+| ["a"] |
++---------------------------------------+
+```
+
+```sql
+select group_array_intersect(c_array_string) from group_array_intersect_test where id is null;
+```
+
+```text
++---------------------------------------+
+| group_array_intersect(c_array_string) |
++---------------------------------------+
+| [] |
++---------------------------------------+
```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md b/docs/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md
index 12c66f8..79211ac 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md
@@ -23,22 +23,27 @@
## Return Value
-The data type of the return value is BITMAP.
+The data type of the return value is BITMAP. If there is no valid data in the group, returns NULL.
## Example
```sql
- select page, bitmap_to_string(user_id) from pv_bitmap;
-```
-
-```text
-+------+-----------------------------+
-| page | bitmap_to_string(`user_id`) |
-+------+-----------------------------+
-| m | 4,7,8 |
-| m | 1,3,6,15 |
-| m | 4,7 |
-+------+-----------------------------+
+-- setup
+CREATE TABLE pv_bitmap (
+ page varchar(10),
+ user_id BITMAP
+) DISTRIBUTED BY HASH(page) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO pv_bitmap VALUES
+ ('m', to_bitmap(4)),
+ ('m', to_bitmap(7)),
+ ('m', to_bitmap(8)),
+ ('m', to_bitmap(1)),
+ ('m', to_bitmap(3)),
+ ('m', to_bitmap(6)),
+ ('m', to_bitmap(15)),
+ ('m', to_bitmap(4)),
+ ('m', to_bitmap(7));
```
```sql
@@ -46,9 +51,21 @@
```
```text
-+------+-----------------------------------------------+
-| page | bitmap_to_string(group_bitmap_xor(`user_id`)) |
-+------+-----------------------------------------------+
-| m | 1,3,6,8,15 |
-+------+-----------------------------------------------+
++------+---------------------------------------------+
+| page | bitmap_to_string(group_bitmap_xor(user_id)) |
++------+---------------------------------------------+
+| m | 1,3,6,8,15 |
++------+---------------------------------------------+
+```
+
+```sql
+select bitmap_to_string(group_bitmap_xor(user_id)) from pv_bitmap where page is null;
+```
+
+```text
++---------------------------------------------+
+| bitmap_to_string(group_bitmap_xor(user_id)) |
++---------------------------------------------+
+| NULL |
++---------------------------------------------+
```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/intersect-count.md b/docs/sql-manual/sql-functions/aggregate-functions/intersect-count.md
index f6ae92a..96365e1 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/intersect-count.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/intersect-count.md
@@ -22,40 +22,42 @@
| Parameter | Description |
|------------------|--------------------------------------------------|
-| `<bitmap_column>` | The input bitmap parameter column |
-| `<column_to_filter>` | The dimension column used for filtering |
-| `<filter_values>` | The different values used to filter the dimension column |
+| `<bitmap_column>` | The input bitmap parameter column. Supported types: Bitmap. |
+| `<column_to_filter>` | The dimension column used for filtering. Supported types: TinyInt, SmallInt, Integer, BigInt, LargeInt. |
+| `<filter_values>` | The different values used to filter the dimension column. Supported types: TinyInt, SmallInt, Integer, BigInt, LargeInt. |
## Return Value
-Return the number of elements in the intersection of the given bitmaps.
+Returns the number of elements in the intersection of the given bitmaps.
## Example
```sql
-select dt,bitmap_to_string(user_id) from pv_bitmap;
-```
-
-```text
-+------+---------------------------+
-| dt | bitmap_to_string(user_id) |
-+------+---------------------------+
-| 1 | 1,2 |
-| 2 | 2,3 |
-| 4 | 1,2,3,4,5 |
-| 3 | 1,2,3 |
-+------+---------------------------+
+-- setup
+CREATE TABLE pv_bitmap (
+ dt INT,
+ user_id BITMAP,
+ city STRING
+) DISTRIBUTED BY HASH(dt) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO pv_bitmap VALUES
+ (20250801, to_bitmap(1), 'beijing'),
+ (20250801, to_bitmap(2), 'beijing'),
+ (20250801, to_bitmap(3), 'shanghai'),
+ (20250802, to_bitmap(3), 'beijing'),
+ (20250802, to_bitmap(4), 'shanghai'),
+ (20250802, to_bitmap(5), 'shenzhen');
```
```sql
-select intersect_count(user_id,dt,3,4) from pv_bitmap;
+select intersect_count(user_id,dt,20250801) from pv_bitmap;
```
```text
-+------------------------------------+
-| intersect_count(user_id, dt, 3, 4) |
-+------------------------------------+
-| 3 |
-+------------------------------------+
++--------------------------------------+
+| intersect_count(user_id,dt,20250801) |
++--------------------------------------+
+| 3 |
++--------------------------------------+
```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/map-agg.md b/docs/sql-manual/sql-functions/aggregate-functions/map-agg.md
index 28f7460..25e55b7 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/map-agg.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/map-agg.md
@@ -15,51 +15,30 @@
## Parameters
-| Parameters | Description |
+| Parameter | Description |
| -- | -- |
-| `<expr1>` | The expression used to specify the key. |
-| `<expr2>` | The expression used to specify the corresponding value. |
+| `<expr1>` | The expression used as the key. Supported types: Bool, TinyInt, SmallInt, Integer, BigInt, LargeInt, Float, Double, Decimal, Date, Datetime, String. |
+| `<expr2>` | The expression used as the value. Supported types: Bool, TinyInt, SmallInt, Integer, BigInt, LargeInt, Float, Double, Decimal, Date, Datetime, String. |
## Return Value
-Returns a value of the MAP type.
+Returns a value of the Map type. If there is no valid data in the group, returns an empty Map.
## Example
```sql
-select `n_nationkey`, `n_name`, `n_regionkey` from `nation`;
-```
-
-```text
-+-------------+----------------+-------------+
-| n_nationkey | n_name | n_regionkey |
-+-------------+----------------+-------------+
-| 0 | ALGERIA | 0 |
-| 1 | ARGENTINA | 1 |
-| 2 | BRAZIL | 1 |
-| 3 | CANADA | 1 |
-| 4 | EGYPT | 4 |
-| 5 | ETHIOPIA | 0 |
-| 6 | FRANCE | 3 |
-| 7 | GERMANY | 3 |
-| 8 | INDIA | 2 |
-| 9 | INDONESIA | 2 |
-| 10 | IRAN | 4 |
-| 11 | IRAQ | 4 |
-| 12 | JAPAN | 2 |
-| 13 | JORDAN | 4 |
-| 14 | KENYA | 0 |
-| 15 | MOROCCO | 0 |
-| 16 | MOZAMBIQUE | 0 |
-| 17 | PERU | 1 |
-| 18 | CHINA | 2 |
-| 19 | ROMANIA | 3 |
-| 20 | SAUDI ARABIA | 4 |
-| 21 | VIETNAM | 2 |
-| 22 | RUSSIA | 3 |
-| 23 | UNITED KINGDOM | 3 |
-| 24 | UNITED STATES | 1 |
-+-------------+----------------+-------------+
+-- setup
+CREATE TABLE nation (
+ n_nationkey INT,
+ n_name STRING,
+ n_regionkey INT
+) DISTRIBUTED BY HASH(n_nationkey) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO nation VALUES
+ (0, 'ALGERIA', 0),
+ (1, 'ARGENTINA', 1),
+ (2, 'BRAZIL', 1),
+ (3, 'CANADA', 1);
```
```sql
@@ -67,18 +46,37 @@
```
```text
-+-------------+---------------------------------------------------------------------------+
-| n_regionkey | map_agg(`n_nationkey`, `n_name`) |
-+-------------+---------------------------------------------------------------------------+
-| 1 | {1:"ARGENTINA", 2:"BRAZIL", 3:"CANADA", 17:"PERU", 24:"UNITED STATES"} |
-| 0 | {0:"ALGERIA", 5:"ETHIOPIA", 14:"KENYA", 15:"MOROCCO", 16:"MOZAMBIQUE"} |
-| 3 | {6:"FRANCE", 7:"GERMANY", 19:"ROMANIA", 22:"RUSSIA", 23:"UNITED KINGDOM"} |
-| 4 | {4:"EGYPT", 10:"IRAN", 11:"IRAQ", 13:"JORDAN", 20:"SAUDI ARABIA"} |
-| 2 | {8:"INDIA", 9:"INDONESIA", 12:"JAPAN", 18:"CHINA", 21:"VIETNAM"} |
-+-------------+---------------------------------------------------------------------------+
++-------------+-----------------------------------------+
+| n_regionkey | map_agg(`n_nationkey`, `n_name`) |
++-------------+-----------------------------------------+
+| 0 | {0:"ALGERIA"} |
+| 1 | {1:"ARGENTINA", 2:"BRAZIL", 3:"CANADA"} |
++-------------+-----------------------------------------+
```
```sql
+select map_agg(`n_name`, `n_nationkey` % 5) from `nation`;
+```
+
+```text
++------------------------------------------------------+
+| map_agg(`n_name`, `n_nationkey` % 5) |
++------------------------------------------------------+
+| {"ALGERIA":0, "ARGENTINA":1, "BRAZIL":2, "CANADA":3} |
++------------------------------------------------------+
+```
+
+```sql
+select map_agg(`n_name`, `n_nationkey` % 5) from `nation` where n_nationkey is null;
+```
+
+```text
++--------------------------------------+
+| map_agg(`n_name`, `n_nationkey` % 5) |
++--------------------------------------+
+| {} |
++--------------------------------------+
+```
select n_regionkey, map_agg(`n_name`, `n_nationkey` % 5) from `nation` group by `n_regionkey`;
```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/array-agg.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/array-agg.md
index 1848054..a4c4bb2 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/array-agg.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/array-agg.md
@@ -19,7 +19,7 @@
| 参数 | 说明 |
| -- | -- |
-| `<col>` | 确定要放入数组的值的表达式(通常是列名) |
+| `<col>` | 确定要放入数组的值的表达式,支持类型为 Bool,TinyInt,SmallInt,Integer,BigInt,LargeInt,Float,Double,Decimal,Date,Datetime,IPV4,IPV6,String,Array,Map,Struct。|
## 返回值
@@ -31,27 +31,13 @@
## 举例
```sql
-select * from test_doris_array_agg;
-```
-
-```text
-+------+------+
-
-| c1 | c2 |
-
-+------+------+
-
-| 1 | a |
-
-| 1 | b |
-
-| 2 | c |
-
-| 2 | NULL |
-
-| 3 | NULL |
-
-+------+------+
+-- setup
+CREATE TABLE test_doris_array_agg (
+ c1 INT,
+ c2 INT
+) DISTRIBUTED BY HASH(c1) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO test_doris_array_agg VALUES (1, 10), (1, 20), (1, 30), (2, 100), (2, 200), (3, NULL);
```
```sql
@@ -59,17 +45,24 @@
```
```text
-+------+-----------------+
-
-| c1 | array_agg(`c2`) |
-
-+------+-----------------+
-
-| 1 | ["a","b"] |
-
-| 2 | [NULL,"c"] |
-
-| 3 | [NULL] |
-
-+------+-----------------+
++------+---------------+
+| c1 | array_agg(c2) |
++------+---------------+
+| 1 | [10, 20, 30] |
+| 2 | [100, 200] |
+| 3 | [null] |
++------+---------------+
```
+
+```sql
+select array_agg(c2) from test_doris_array_agg where c1 is null;
+```
+
+```text
++---------------+
+| array_agg(c2) |
++---------------+
+| [] |
++---------------+
+```
+
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-list.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-list.md
index ec8e4db..3d5682f 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-list.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-list.md
@@ -7,7 +7,7 @@
## 描述
-聚合函数,用于将某一列的所有值聚集成一个数组
+将表达式的所有非 NULL 值聚集成一个数组。
## 别名
@@ -23,33 +23,25 @@
| 参数 | 说明 |
| -- | -- |
-| `<expr>` | 要聚合的列或表达式 |
-| `<max_size>` | 可选参数,通过设置该参数能够将结果数组的大小限制为 max_size 个元素 |
+| `<expr>` | 确定要放入数组的值的表达式,支持类型为 Bool,TinyInt,SmallInt,Integer,BigInt,LargeInt,Float,Double,Decimal,Date,Datetime,IPV4,IPV6,String,Array,Map,Struct。|
+| `<max_size>` | 可选参数,通过设置该参数能够将结果数组的大小限制为 max_size 个元素,支持类型为 Integer。 |
## 返回值
-返回类型是 ARRAY,该数组包含所有值。特殊情况:
-
-- 如果值为 NULL,则会过滤
+返回类型是 ARRAY,该数组包含所有非 NULL 值。
+如果组内没有合法数据,则返回空数组。
## 举例
```sql
-select k1,k2,k3 from collect_list_test order by k1;
-```
-
-```text
-+------+------------+-------+
-| k1 | k2 | k3 |
-+------+------------+-------+
-| 1 | 2023-01-01 | hello |
-| 2 | 2023-01-02 | NULL |
-| 2 | 2023-01-02 | hello |
-| 3 | NULL | world |
-| 3 | 2023-01-02 | hello |
-| 4 | 2023-01-02 | sql |
-| 4 | 2023-01-03 | sql |
-+------+------------+-------+
+-- setup
+CREATE TABLE collect_list_test (
+ k1 INT,
+ k2 INT,
+ k3 STRING
+) DISTRIBUTED BY HASH(k1) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO collect_list_test VALUES (1, 10, 'a'), (1, 20, 'b'), (1, 30, 'c'), (2, 100, 'x'), (2, 200, 'y'), (3, NULL, NULL);
```
```sql
@@ -57,11 +49,11 @@
```
```text
-+-------------------------+--------------------------+
-| collect_list(`k1`) | collect_list(`k1`,3) |
-+-------------------------+--------------------------+
-| [1,2,2,3,3,4,4] | [1,2,2] |
-+-------------------------+--------------------------+
++--------------------+--------------------+
+| collect_list(k1) | collect_list(k1,3) |
++--------------------+--------------------+
+| [1, 1, 1, 2, 2, 3] | [1, 1, 1] |
++--------------------+--------------------+
```
```sql
@@ -69,13 +61,12 @@
```
```text
-+------+-------------------------+--------------------------+
-| k1 | collect_list(`k2`) | collect_list(`k3`,1) |
-+------+-------------------------+--------------------------+
-| 1 | [2023-01-01] | [hello] |
-| 2 | [2023-01-02,2023-01-02] | [hello] |
-| 3 | [2023-01-02] | [world] |
-| 4 | [2023-01-02,2023-01-03] | [sql] |
-+------+-------------------------+--------------------------+
++------+------------------+--------------------+
+| k1 | collect_list(k2) | collect_list(k3,1) |
++------+------------------+--------------------+
+| 1 | [10, 20, 30] | ["a"] |
+| 2 | [100, 200] | ["x"] |
+| 3 | [] | [] |
++------+------------------+--------------------+
```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-set.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-set.md
index fe3c37d..4894e9b 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-set.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/collect-set.md
@@ -7,7 +7,7 @@
## 描述
-聚合函数,聚合指定列的所有唯一值,去除重复的元素,并返回一个集合类型的结果。
+将表达式的所有非 NULL 值去重后聚集成一个数组。
## 别名
@@ -23,33 +23,25 @@
| 参数 | 说明 |
| -- | -- |
-| `<expr>` | 要聚合的列或表达式 |
-| `<max_size>` | 可选参数,通过设置该参数能够将结果数组的大小限制为 max_size 个元素 |
+| `<expr>` | 确定要放入数组的值的表达式,支持类型为 Bool,TinyInt,SmallInt,Integer,BigInt,LargeInt,Float,Double,Decimal,Date,Datetime,IPV4,IPV6,String,Array,Map,Struct。 |
+| `<max_size>` | 可选参数,通过设置该参数能够将结果数组的大小限制为 max_size 个元素,支持类型为 Integer。 |
## 返回值
-返回类型是 ARRAY,该数组包含去重后的所有值,特殊情况:
-
-- 如果值为 NULL,则会过滤
+返回类型是 ARRAY,该数组包含所有非 NULL 值。
+如果组内没有合法数据,则返回空数组。
## 举例
```sql
-select k1,k2,k3 from collect_set_test order by k1;
-```
-
-```text
-+------+------------+-------+
-| k1 | k2 | k3 |
-+------+------------+-------+
-| 1 | 2023-01-01 | hello |
-| 2 | 2023-01-01 | NULL |
-| 2 | 2023-01-02 | hello |
-| 3 | NULL | world |
-| 3 | 2023-01-02 | hello |
-| 4 | 2023-01-02 | doris |
-| 4 | 2023-01-03 | sql |
-+------+------------+-------+
+-- setup
+CREATE TABLE collect_set_test (
+ k1 INT,
+ k2 INT,
+ k3 STRING
+) DISTRIBUTED BY HASH(k1) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO collect_set_test VALUES (1, 10, 'a'), (1, 20, 'b'), (1, 10, 'a'), (2, 100, 'x'), (2, 200, 'y'), (3, NULL, NULL);
```
```sql
@@ -57,11 +49,11 @@
```
```text
-+-------------------------+--------------------------+
-| collect_set(`k1`) | collect_set(`k1`,2) |
-+-------------------------+--------------------------+
-| [4,3,2,1] | [1,2] |
-+----------------------------------------------------+
++-----------------+-------------------+
+| collect_set(k1) | collect_set(k1,2) |
++-----------------+-------------------+
+| [2, 1, 3] | [2, 1] |
++-----------------+-------------------+
```
```sql
@@ -69,12 +61,11 @@
```
```text
-+------+-------------------------+--------------------------+
-| k1 | collect_set(`k2`) | collect_set(`k3`,1) |
-+------+-------------------------+--------------------------+
-| 1 | [2023-01-01] | [hello] |
-| 2 | [2023-01-01,2023-01-02] | [hello] |
-| 3 | [2023-01-02] | [world] |
-| 4 | [2023-01-02,2023-01-03] | [sql] |
-+------+-------------------------+--------------------------+
++------+-----------------+-------------------+
+| k1 | collect_set(k2) | collect_set(k3,1) |
++------+-----------------+-------------------+
+| 1 | [20, 10] | ["a"] |
+| 2 | [200, 100] | ["x"] |
+| 3 | [] | [] |
++------+-----------------+-------------------+
```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md
index d3648a3..78c7d90 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-array-intersect.md
@@ -19,36 +19,48 @@
| 参数 | 说明 |
| -- | -- |
-| `<expr>` | 需要求交集的数组列或数组值 |
+| `<expr>` | 需要求交集的表达式,支持类型为 Array。 |
## 返回值
-返回一个包含交集结果的数组
+返回一个包含交集结果的数组。
+如果组内没有合法数据,则返回空数组。
## 举例
```sql
-select c_array_string from group_array_intersect_test where id in (18, 20);
-```
-
-```text
-+------+---------------------------+
-| id | col |
-+------+---------------------------+
-| 1 | ["a", "b", "c", "d", "e"] |
-| 2 | ["a", "b"] |
-| 3 | ["a", null] |
-+------+---------------------------+
+-- setup
+CREATE TABLE group_array_intersect_test (
+ id INT,
+ c_array_string ARRAY<STRING>
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO group_array_intersect_test VALUES
+ (1, ['a', 'b', 'c', 'd', 'e']),
+ (2, ['a', 'b']),
+ (3, ['a', null]);
```
```sql
-select group_array_intersect(col) from group_array_intersect_test;
+select group_array_intersect(c_array_string) from group_array_intersect_test;
```
```text
-+----------------------------+
-| group_array_intersect(col) |
-+----------------------------+
-| ["a"] |
-+----------------------------+
++---------------------------------------+
+| group_array_intersect(c_array_string) |
++---------------------------------------+
+| ["a"] |
++---------------------------------------+
+```
+
+```sql
+select group_array_intersect(c_array_string) from group_array_intersect_test where id is null;
+```
+
+```text
++---------------------------------------+
+| group_array_intersect(c_array_string) |
++---------------------------------------+
+| [] |
++---------------------------------------+
```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md
index 199db03..7e5e60b 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/group-bitmap-xor.md
@@ -24,21 +24,27 @@
## 返回值
返回值的数据类型为 BITMAP。
+当组内没有合法数据时,返回 NULL 。
## 举例
```sql
- select page, bitmap_to_string(user_id) from pv_bitmap;
-```
-
-```text
-+------+-----------------------------+
-| page | bitmap_to_string(`user_id`) |
-+------+-----------------------------+
-| m | 4,7,8 |
-| m | 1,3,6,15 |
-| m | 4,7 |
-+------+-----------------------------+
+-- setup
+CREATE TABLE pv_bitmap (
+ page varchar(10),
+ user_id BITMAP
+) DISTRIBUTED BY HASH(page) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO pv_bitmap VALUES
+ ('m', to_bitmap(4)),
+ ('m', to_bitmap(7)),
+ ('m', to_bitmap(8)),
+ ('m', to_bitmap(1)),
+ ('m', to_bitmap(3)),
+ ('m', to_bitmap(6)),
+ ('m', to_bitmap(15)),
+ ('m', to_bitmap(4)),
+ ('m', to_bitmap(7));
```
```sql
@@ -46,9 +52,22 @@
```
```text
-+------+-----------------------------------------------+
-| page | bitmap_to_string(group_bitmap_xor(`user_id`)) |
-+------+-----------------------------------------------+
-| m | 1,3,6,8,15 |
-+------+-----------------------------------------------+
++------+---------------------------------------------+
+| page | bitmap_to_string(group_bitmap_xor(user_id)) |
++------+---------------------------------------------+
+| m | 1,3,6,8,15 |
++------+---------------------------------------------+
+```
+
+
+```sql
+select bitmap_to_string(group_bitmap_xor(user_id)) from pv_bitmap where page is null;
+```
+
+```text
++---------------------------------------------+
+| bitmap_to_string(group_bitmap_xor(user_id)) |
++---------------------------------------------+
+| NULL |
++---------------------------------------------+
```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/intersect-count.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/intersect-count.md
index 3064080..c74351f 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/intersect-count.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/intersect-count.md
@@ -7,9 +7,10 @@
## 描述
-聚合函数,求 bitmap 交集大小的函数,不要求数据分布正交
+聚合函数,求 bitmap 交集大小的函数。
第一个参数是 Bitmap 列,第二个参数是用来过滤的维度列,第三个参数是变长参数,含义是过滤维度列的不同取值。
计算 bitmap_column 中符合 column_to_filter 在 filter_values 之内的元素的交集数量,即 bitmap 交集计数。
+对于 filter_values 相同的数据,取它们 bitmap 的并集,最终对每个 filter_values 的并集 bitmap 求交集。
## 语法
@@ -22,8 +23,8 @@
| 参数 | 说明 |
| -- | -- |
| `<bitmap_column>` | 输入的 bitmap 参数列 |
-| `<column_to_filter>` | 是用来过滤的维度列 |
-| `<filter_values>` | 是过滤维度列的不同取值 |
+| `<column_to_filter>` | 是用来过滤的维度列,支持类型为 TinyInt,SmallInt,Integer,BigInt,LargeInt。 |
+| `<filter_values>` | 是过滤维度列的不同取值,TinyInt,SmallInt,Integer,BigInt,LargeInt。 |
## 返回值
@@ -32,28 +33,42 @@
## 举例
```sql
-select dt,bitmap_to_string(user_id) from pv_bitmap;
-```
-
-```text
-+------+---------------------------+
-| dt | bitmap_to_string(user_id) |
-+------+---------------------------+
-| 1 | 1,2 |
-| 2 | 2,3 |
-| 4 | 1,2,3,4,5 |
-| 3 | 1,2,3 |
-+------+---------------------------+
+-- setup
+CREATE TABLE pv_bitmap (
+ dt INT,
+ user_id BITMAP,
+ city STRING
+) DISTRIBUTED BY HASH(dt) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO pv_bitmap VALUES
+ (20250801, to_bitmap(1), 'beijing'),
+ (20250801, to_bitmap(2), 'beijing'),
+ (20250801, to_bitmap(3), 'shanghai'),
+ (20250802, to_bitmap(3), 'beijing'),
+ (20250802, to_bitmap(4), 'shanghai'),
+ (20250802, to_bitmap(5), 'shenzhen');
```
```sql
-select intersect_count(user_id,dt,3,4) from pv_bitmap;
+select intersect_count(user_id,dt,20250801) from pv_bitmap;
```
```text
-+------------------------------------+
-| intersect_count(user_id, dt, 3, 4) |
-+------------------------------------+
-| 3 |
-+------------------------------------+
++--------------------------------------+
+| intersect_count(user_id,dt,20250801) |
++--------------------------------------+
+| 3 |
++--------------------------------------+
+```
+
+```sql
+select intersect_count(user_id,dt,20250801,20250802) from pv_bitmap;
+```
+
+```text
++-----------------------------------------------+
+| intersect_count(user_id,dt,20250801,20250802) |
++-----------------------------------------------+
+| 1 |
++-----------------------------------------------+
```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/map-agg.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/map-agg.md
index fa4907a..67b95e4 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/map-agg.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/map-agg.md
@@ -17,49 +17,29 @@
| 参数 | 说明 |
| -- | -- |
-| `<expr1>` | 用于指定作为键的表达式。 |
-| `<expr2>` | 用于指定作为对应的值的表达式。 |
+| `<expr1>` | 用于指定作为键的表达式, 支持类型为Bool,TinyInt,SmallInt,Integer,BigInt,LargeInt,Float,Double,Decimal,Date,Datetime,String。|
+| `<expr2>` | 用于指定作为对应的值的表达式, 支持类型为Bool,TinyInt,SmallInt,Integer,BigInt,LargeInt,Float,Double,Decimal,Date,Datetime,String。 |
## 返回值
-返回映射后的 MAP 类型的值。
+返回映射后的 Map 类型的值。
+如果组内不存在合法数据,则返回一个空 Map 。
## 举例
```sql
-select `n_nationkey`, `n_name`, `n_regionkey` from `nation`;
-```
-
-```text
-+-------------+----------------+-------------+
-| n_nationkey | n_name | n_regionkey |
-+-------------+----------------+-------------+
-| 0 | ALGERIA | 0 |
-| 1 | ARGENTINA | 1 |
-| 2 | BRAZIL | 1 |
-| 3 | CANADA | 1 |
-| 4 | EGYPT | 4 |
-| 5 | ETHIOPIA | 0 |
-| 6 | FRANCE | 3 |
-| 7 | GERMANY | 3 |
-| 8 | INDIA | 2 |
-| 9 | INDONESIA | 2 |
-| 10 | IRAN | 4 |
-| 11 | IRAQ | 4 |
-| 12 | JAPAN | 2 |
-| 13 | JORDAN | 4 |
-| 14 | KENYA | 0 |
-| 15 | MOROCCO | 0 |
-| 16 | MOZAMBIQUE | 0 |
-| 17 | PERU | 1 |
-| 18 | CHINA | 2 |
-| 19 | ROMANIA | 3 |
-| 20 | SAUDI ARABIA | 4 |
-| 21 | VIETNAM | 2 |
-| 22 | RUSSIA | 3 |
-| 23 | UNITED KINGDOM | 3 |
-| 24 | UNITED STATES | 1 |
-+-------------+----------------+-------------+
+-- setup
+CREATE TABLE nation (
+ n_nationkey INT,
+ n_name STRING,
+ n_regionkey INT
+) DISTRIBUTED BY HASH(n_nationkey) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+INSERT INTO nation VALUES
+ (0, 'ALGERIA', 0),
+ (1, 'ARGENTINA', 1),
+ (2, 'BRAZIL', 1),
+ (3, 'CANADA', 1);
```
```sql
@@ -67,29 +47,35 @@
```
```text
-+-------------+---------------------------------------------------------------------------+
-| n_regionkey | map_agg(`n_nationkey`, `n_name`) |
-+-------------+---------------------------------------------------------------------------+
-| 1 | {1:"ARGENTINA", 2:"BRAZIL", 3:"CANADA", 17:"PERU", 24:"UNITED STATES"} |
-| 0 | {0:"ALGERIA", 5:"ETHIOPIA", 14:"KENYA", 15:"MOROCCO", 16:"MOZAMBIQUE"} |
-| 3 | {6:"FRANCE", 7:"GERMANY", 19:"ROMANIA", 22:"RUSSIA", 23:"UNITED KINGDOM"} |
-| 4 | {4:"EGYPT", 10:"IRAN", 11:"IRAQ", 13:"JORDAN", 20:"SAUDI ARABIA"} |
-| 2 | {8:"INDIA", 9:"INDONESIA", 12:"JAPAN", 18:"CHINA", 21:"VIETNAM"} |
-+-------------+---------------------------------------------------------------------------+
++-------------+-----------------------------------------+
+| n_regionkey | map_agg(`n_nationkey`, `n_name`) |
++-------------+-----------------------------------------+
+| 0 | {0:"ALGERIA"} |
+| 1 | {1:"ARGENTINA", 2:"BRAZIL", 3:"CANADA"} |
++-------------+-----------------------------------------+
```
```sql
-select n_regionkey, map_agg(`n_name`, `n_nationkey` % 5) from `nation` group by `n_regionkey`;
+select map_agg(`n_name`, `n_nationkey` % 5) from `nation`;
```
```text
-+-------------+------------------------------------------------------------------------+
-| n_regionkey | map_agg(`n_name`, (`n_nationkey` % 5)) |
-+-------------+------------------------------------------------------------------------+
-| 2 | {"INDIA":3, "INDONESIA":4, "JAPAN":2, "CHINA":3, "VIETNAM":1} |
-| 0 | {"ALGERIA":0, "ETHIOPIA":0, "KENYA":4, "MOROCCO":0, "MOZAMBIQUE":1} |
-| 3 | {"FRANCE":1, "GERMANY":2, "ROMANIA":4, "RUSSIA":2, "UNITED KINGDOM":3} |
-| 1 | {"ARGENTINA":1, "BRAZIL":2, "CANADA":3, "PERU":2, "UNITED STATES":4} |
-| 4 | {"EGYPT":4, "IRAN":0, "IRAQ":1, "JORDAN":3, "SAUDI ARABIA":0} |
-+-------------+------------------------------------------------------------------------+
++------------------------------------------------------+
+| map_agg(`n_name`, `n_nationkey` % 5) |
++------------------------------------------------------+
+| {"ALGERIA":0, "ARGENTINA":1, "BRAZIL":2, "CANADA":3} |
++------------------------------------------------------+
```
+
+```sql
+select map_agg(`n_name`, `n_nationkey` % 5) from `nation` where n_nationkey is null;
+```
+
+```text
++--------------------------------------+
+| map_agg(`n_name`, `n_nationkey` % 5) |
++--------------------------------------+
+| {} |
++--------------------------------------+
+```
+