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 381efffa921 [doc](agg) Support max/min agg functions for type_array
(#3128)
381efffa921 is described below
commit 381efffa92181c26b54504627ca58ce3f2637e63
Author: admiring_xm <[email protected]>
AuthorDate: Wed Dec 3 12:54:19 2025 +0800
[doc](agg) Support max/min agg functions for type_array (#3128)
## Versions
- [x] dev
- [x] 4.x
- [ ] 3.x
- [ ] 2.1
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../sql-functions/aggregate-functions/max.md | 31 +++++++++++++++++-----
.../sql-functions/aggregate-functions/min.md | 31 +++++++++++++++++-----
.../sql-functions/aggregate-functions/max.md | 31 +++++++++++++++++-----
.../sql-functions/aggregate-functions/min.md | 31 +++++++++++++++++-----
.../sql-functions/aggregate-functions/max.md | 31 +++++++++++++++++-----
.../sql-functions/aggregate-functions/min.md | 31 +++++++++++++++++-----
.../sql-functions/aggregate-functions/max.md | 31 +++++++++++++++++-----
.../sql-functions/aggregate-functions/min.md | 31 +++++++++++++++++-----
8 files changed, 192 insertions(+), 56 deletions(-)
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/max.md
b/docs/sql-manual/sql-functions/aggregate-functions/max.md
index ac90ba6628d..0bd6969cbad 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/max.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/max.md
@@ -19,7 +19,7 @@ MAX(<expr>)
| Parameters | Description |
| -- | -- |
-| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal. |
+| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal, Array. |
## Return Value
@@ -34,15 +34,16 @@ If all records in the group are NULL, the function returns
NULL.
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -77,6 +78,22 @@ For Decimal type: Returns the maximum high-precision decimal
value.
+------+----------------+
```
+```sql
+select k1, max(k_array) from t1 group by k1;
+```
+
+For Array type: Returns the maximum array value for each group(Compare
elements one by one; null is the smallest element.).
+
+```text
++------+--------------+
+| k1 | max(k_array) |
++------+--------------+
+| 1 | [10, 20, 30] |
+| 2 | [10, 20, 40] |
+| 3 | NULL |
++------+--------------+
+```
+
```sql
select max(k_string) from t1 where k1 = 3;
```
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/min.md
b/docs/sql-manual/sql-functions/aggregate-functions/min.md
index 91402b0d64c..59ee15880fe 100644
--- a/docs/sql-manual/sql-functions/aggregate-functions/min.md
+++ b/docs/sql-manual/sql-functions/aggregate-functions/min.md
@@ -19,7 +19,7 @@ MIN(<expr>)
| Parameters | Description |
| -- | -- |
-| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal. |
+| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal, Array. |
## Return Value
@@ -33,15 +33,16 @@ If all records in the group are NULL, the function returns
NULL.
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -76,6 +77,22 @@ Decimal type: Returns the minimum high-precision decimal
value.
+------+----------------+
```
+```sql
+select k1, min(k_array) from t1 group by k1;
+```
+
+For Array type: Returns the minimum array value for each group(Compare
elements one by one; null is the smallest element.).
+
+```text
++------+----------------+
+| k1 | min(k_array) |
++------+----------------+
+| 1 | [10, 20] |
+| 2 | [10, 20, null] |
+| 3 | NULL |
++------+----------------+
+```
+
```sql
select min(k_string) from t1 where k1 = 3;
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/max.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/max.md
index d8a986dbb28..bc6ede1ebdc 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/max.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/max.md
@@ -19,7 +19,7 @@ MAX(<expr>)
| 参数 | 说明 |
| -- | -- |
-| `<expr>` | 用于获取值的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal。
|
+| `<expr>` | 用于获取值的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal、Array。
|
## 返回值
@@ -33,15 +33,16 @@ MAX(<expr>)
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -76,6 +77,22 @@ Decimal 类型:返回最大的高精度小数值。
+------+----------------+
```
+```sql
+select k1, max(k_array) from t1 group by k1;
+```
+
+Array 类型: 返回最大的数组值(逐元素比较大小,null为最小元素)。
+
+```text
++------+--------------+
+| k1 | max(k_array) |
++------+--------------+
+| 1 | [10, 20, 30] |
+| 2 | [10, 20, 40] |
+| 3 | NULL |
++------+--------------+
+```
+
```sql
select max(k_string) from t1 where k1 = 3;
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/min.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/min.md
index ab95a510908..65e144007cc 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/min.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/min.md
@@ -19,7 +19,7 @@ MIN(<expr>)
| 参数 | 说明 |
| -- | -- |
-| `<expr>` | 用于计算的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal。
|
+| `<expr>` | 用于计算的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal、Array。
|
## 返回值
@@ -33,15 +33,16 @@ MIN(<expr>)
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -76,6 +77,22 @@ Decimal 类型:返回最小的高精度小数值。
+------+----------------+
```
+```sql
+select k1, min(k_array) from t1 group by k1;
+```
+
+Array 类型: 返回最小的数组值(逐元素比较大小,null为最小元素)。
+
+```text
++------+----------------+
+| k1 | min(k_array) |
++------+----------------+
+| 1 | [10, 20] |
+| 2 | [10, 20, null] |
+| 3 | NULL |
++------+----------------+
+```
+
```sql
select min(k_string) from t1 where k1 = 3;
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
index d8a986dbb28..be8fa723a61 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
@@ -19,7 +19,7 @@ MAX(<expr>)
| 参数 | 说明 |
| -- | -- |
-| `<expr>` | 用于获取值的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal。
|
+| `<expr>` | 用于获取值的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal,
Array。 |
## 返回值
@@ -33,15 +33,16 @@ MAX(<expr>)
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -76,6 +77,22 @@ Decimal 类型:返回最大的高精度小数值。
+------+----------------+
```
+```sql
+select k1, max(k_array) from t1 group by k1;
+```
+
+Array 类型: 返回最大的数组值(逐元素比较大小,null为最小元素)。
+
+```text
++------+--------------+
+| k1 | max(k_array) |
++------+--------------+
+| 1 | [10, 20, 30] |
+| 2 | [10, 20, 40] |
+| 3 | NULL |
++------+--------------+
+```
+
```sql
select max(k_string) from t1 where k1 = 3;
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
index ab95a510908..65e144007cc 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
@@ -19,7 +19,7 @@ MIN(<expr>)
| 参数 | 说明 |
| -- | -- |
-| `<expr>` | 用于计算的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal。
|
+| `<expr>` | 用于计算的表达式。支持的类型包括
String、Time、Date、DateTime、IPv4、IPv6、TinyInt、SmallInt、Integer、BigInt、LargeInt、Float、Double、Decimal、Array。
|
## 返回值
@@ -33,15 +33,16 @@ MIN(<expr>)
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -76,6 +77,22 @@ Decimal 类型:返回最小的高精度小数值。
+------+----------------+
```
+```sql
+select k1, min(k_array) from t1 group by k1;
+```
+
+Array 类型: 返回最小的数组值(逐元素比较大小,null为最小元素)。
+
+```text
++------+----------------+
+| k1 | min(k_array) |
++------+----------------+
+| 1 | [10, 20] |
+| 2 | [10, 20, null] |
+| 3 | NULL |
++------+----------------+
+```
+
```sql
select min(k_string) from t1 where k1 = 3;
```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
index ac90ba6628d..0bd6969cbad 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/max.md
@@ -19,7 +19,7 @@ MAX(<expr>)
| Parameters | Description |
| -- | -- |
-| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal. |
+| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal, Array. |
## Return Value
@@ -34,15 +34,16 @@ If all records in the group are NULL, the function returns
NULL.
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -77,6 +78,22 @@ For Decimal type: Returns the maximum high-precision decimal
value.
+------+----------------+
```
+```sql
+select k1, max(k_array) from t1 group by k1;
+```
+
+For Array type: Returns the maximum array value for each group(Compare
elements one by one; null is the smallest element.).
+
+```text
++------+--------------+
+| k1 | max(k_array) |
++------+--------------+
+| 1 | [10, 20, 30] |
+| 2 | [10, 20, 40] |
+| 3 | NULL |
++------+--------------+
+```
+
```sql
select max(k_string) from t1 where k1 = 3;
```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
index 91402b0d64c..59ee15880fe 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/min.md
@@ -19,7 +19,7 @@ MIN(<expr>)
| Parameters | Description |
| -- | -- |
-| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal. |
+| `<expr>` | The expression to get the value. Supported types are String,
Time, Date, DateTime, IPv4, IPv6, TinyInt, SmallInt, Integer, BigInt, LargeInt,
Float, Double, Decimal, Array. |
## Return Value
@@ -33,15 +33,16 @@ If all records in the group are NULL, the function returns
NULL.
create table t1(
k1 int,
k_string varchar(100),
- k_decimal decimal(10, 2)
+ k_decimal decimal(10, 2),
+ k_array array<int>
) distributed by hash (k1) buckets 1
properties ("replication_num"="1");
insert into t1 values
- (1, 'apple', 10.01),
- (1, 'banana', 20.02),
- (2, 'orange', 30.03),
- (2, null, null),
- (3, null, null);
+ (1, 'apple', 10.01, [10, 20, 30]),
+ (1, 'banana', 20.02, [10, 20]),
+ (2, 'orange', 30.03, [10, 20, 40]),
+ (2, null, null, [10, 20, null]),
+ (3, null, null, null);
```
```sql
@@ -76,6 +77,22 @@ Decimal type: Returns the minimum high-precision decimal
value.
+------+----------------+
```
+```sql
+select k1, min(k_array) from t1 group by k1;
+```
+
+For Array type: Returns the minimum array value for each group(Compare
elements one by one; null is the smallest element.).
+
+```text
++------+----------------+
+| k1 | min(k_array) |
++------+----------------+
+| 1 | [10, 20] |
+| 2 | [10, 20, null] |
+| 3 | NULL |
++------+----------------+
+```
+
```sql
select min(k_string) from t1 where k1 = 3;
```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]