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

lihaopeng 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 16a1dee2554 [Feature](agg) Support bool agg functions (#2839)
16a1dee2554 is described below

commit 16a1dee2554dde596e880e37062d63a731aac287
Author: linrrarity <[email protected]>
AuthorDate: Fri Sep 12 11:44:46 2025 +0800

    [Feature](agg) Support bool agg functions (#2839)
---
 .../sql-functions/aggregate-functions/bool-and.md  | 145 ++++++++++++++++++++
 .../sql-functions/aggregate-functions/bool-or.md   | 146 +++++++++++++++++++++
 .../sql-functions/aggregate-functions/bool-xor.md  | 146 +++++++++++++++++++++
 .../sql-functions/aggregate-functions/bool-and.md  | 146 +++++++++++++++++++++
 .../sql-functions/aggregate-functions/bool-or.md   | 145 ++++++++++++++++++++
 .../sql-functions/aggregate-functions/bool-xor.md  | 145 ++++++++++++++++++++
 sidebars.json                                      |   6 +
 7 files changed, 879 insertions(+)

diff --git a/docs/sql-manual/sql-functions/aggregate-functions/bool-and.md 
b/docs/sql-manual/sql-functions/aggregate-functions/bool-and.md
new file mode 100644
index 00000000000..0926c3b8a87
--- /dev/null
+++ b/docs/sql-manual/sql-functions/aggregate-functions/bool-and.md
@@ -0,0 +1,145 @@
+---
+{
+"title": "BOOL_AND",
+"language": "en"
+}
+---
+
+## Description
+
+Performs a logical AND aggregation over all non-NULL values of the expression.
+
+## Alias
+
+- BOOLAND_AGG
+
+## Syntax
+
+```text
+BOOL_AND(<expr>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<expr>` | Expression to be aggregated with logical AND. Supports BOOLEAN 
type and numeric types that can be converted to boolean by the 0/non-0 rule (0 
is FALSE, non-0 is TRUE). |
+
+## Return Value
+
+The return value is BOOLEAN. It returns TRUE only when all non-NULL values are 
TRUE; otherwise, it returns FALSE.
+
+If all values of the expression are NULL or the expression is empty, the 
function returns NULL.
+
+## Examples
+
+setup :
+```sql
+CREATE TABLE IF NOT EXISTS test_boolean_agg (
+     id INT,
+     c1 BOOLEAN,
+     c2 BOOLEAN,
+     c3 BOOLEAN,
+     c4 BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1"); 
+
+INSERT INTO test_boolean_agg (id, c1, c2, c3, c4) values 
+(1, true, true, true, false),
+(2, true, false, false, false),
+(3, true, true, false, false),
+(4, true, false, false, false);
+```
+
+### Aggregate function:
+```sql
+SELECT booland_agg(c1), booland_agg(c2), booland_agg(c3), booland_agg(c4)
+FROM test_boolean_agg;
+```
+```text
++-----------------+-----------------+-----------------+-----------------+
+| booland_agg(c1) | booland_agg(c2) | booland_agg(c3) | booland_agg(c4) |
++-----------------+-----------------+-----------------+-----------------+
+|               1 |               0 |               0 |               0 |
++-----------------+-----------------+-----------------+-----------------+
+```
+
+bool_and can also accept numeric type parameters, if the number is not 0, it 
will be converted to `TRUE`
+```sql
+CREATE TABLE test_numeric_and_null (
+    id INT,
+    c_int INT,
+    c_float FLOAT,
+    c_decimal DECIMAL(10,2),
+    c_bool BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_numeric_and_null (id, c_int, c_float, c_decimal, c_bool) 
VALUES
+(1, 1, 1.0, NULL, NULL),
+(2, 0, NULL, 0.00, NULL),
+(3, 1, 3.14, 1.00, NULL),
+(4, 0, 1.0, 0.00, NULL),
+(5, NULL, NULL, NULL, NULL);
+```
+
+```sql
+SELECT
+    BOOL_AND(c_int) AS bool_and_int,
+    BOOL_AND(c_float) AS bool_and_float,
+    BOOL_AND(c_decimal) AS bool_and_decimal,
+    BOOL_AND(c_bool) AS bool_and_bool
+FROM test_numeric_and_null;
+```
+```text
++--------------+----------------+------------------+---------------+
+| bool_and_int | bool_and_float | bool_and_decimal | bool_and_bool |
++--------------+----------------+------------------+---------------+
+|            0 |              1 |                0 |          NULL |
++--------------+----------------+------------------+---------------+
+```
+
+### Window function:
+The following example partitions the rows based on the condition (id > 2), 
+divides them into two groups, and displays the window aggregation results:
+```sql
+SELECT * FROM test_boolean_agg;
+```
+```text
++------+------+------+------+------+
+| id   | c1   | c2   | c3   | c4   |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+```sql
+SELECT
+    id,
+    BOOLAND_AGG(c1) OVER (PARTITION BY (id > 2)) AS a,
+    BOOLAND_AGG(c2) OVER (PARTITION BY (id > 2)) AS b,
+    BOOLAND_AGG(c3) OVER (PARTITION BY (id > 2)) AS c,
+    BOOLAND_AGG(c4) OVER (PARTITION BY (id > 2)) AS d
+FROM test_boolean_agg
+ORDER BY id;
+```
+```text
++------+------+------+------+------+
+| id   | a    | b    | c    | d    |
++------+------+------+------+------+
+|    1 |    1 |    0 |    0 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    0 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+
+### Error example:
+```sql
+SELECT BOOL_AND('invalid type');
+```
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = bool_and requires a boolean 
or numeric argument
+```
\ No newline at end of file
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/bool-or.md 
b/docs/sql-manual/sql-functions/aggregate-functions/bool-or.md
new file mode 100644
index 00000000000..7e869b58c83
--- /dev/null
+++ b/docs/sql-manual/sql-functions/aggregate-functions/bool-or.md
@@ -0,0 +1,146 @@
+---
+{
+"title": "BOOL_OR",
+"language": "en"
+}
+---
+
+## Description
+
+Performs a logical OR aggregation over all non-NULL values of the expression.
+
+## Alias
+
+- BOOLOR_AGG
+
+## Syntax
+
+```text
+BOOL_OR(<expr>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<expr>` | Expression to be aggregated with logical OR. Supports BOOLEAN 
type and numeric types that can be converted to boolean by the 0/non-0 rule (0 
is FALSE, non-0 is TRUE). |
+
+## Return Value
+
+The return value is BOOLEAN. It returns TRUE when all non-NULL values exist, 
otherwise it returns FALSE.
+
+If all values of the expression are NULL or the expression is empty, the 
function returns NULL.
+
+## Examples
+
+Setup :
+```sql
+CREATE TABLE IF NOT EXISTS test_boolean_agg (
+     id INT,
+     c1 BOOLEAN,
+     c2 BOOLEAN,
+     c3 BOOLEAN,
+     c4 BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1"); 
+
+INSERT INTO test_boolean_agg (id, c1, c2, c3, c4) values 
+(1, true, true, true, false),
+(2, true, false, false, false),
+(3, true, true, false, false),
+(4, true, false, false, false);
+```
+
+### Aggregate function:
+```sql
+SELECT BOOLOR_AGG(c1), BOOLOR_AGG(c2), BOOLOR_AGG(c3), BOOLOR_AGG(c4)
+FROM test_boolean_agg;
+```
+```text
++----------------+----------------+----------------+----------------+
+| BOOLOR_AGG(c1) | BOOLOR_AGG(c2) | BOOLOR_AGG(c3) | BOOLOR_AGG(c4) |
++----------------+----------------+----------------+----------------+
+|              1 |              1 |              1 |              0 |
++----------------+----------------+----------------+----------------+
+```
+
+
+BOOL_OR also accepts numeric types; non-zero values are treated as `TRUE`:
+```sql
+CREATE TABLE test_numeric_or_null (
+    id INT,
+    c_int INT,
+    c_float FLOAT,
+    c_decimal DECIMAL(10,2),
+    c_bool BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_numeric_or_null (id, c_int, c_float, c_decimal, c_bool) VALUES
+(1, 1, 1.0, NULL, NULL),
+(2, 0, NULL, 0.00, NULL),
+(3, 1, 3.14, 1.00, NULL),
+(4, 0, 1.0, 0.00, NULL),
+(5, NULL, NULL, NULL, NULL);
+```
+
+```sql
+SELECT
+    BOOL_OR(c_int) AS bool_or_int,
+    BOOL_OR(c_float) AS bool_or_float,
+    BOOL_OR(c_decimal) AS bool_or_decimal,
+    BOOL_OR(c_bool) AS bool_or_bool
+FROM test_numeric_or_null;
+```
+```text
++-------------+---------------+-----------------+--------------+
+| bool_or_int | bool_or_float | bool_or_decimal | bool_or_bool |
++-------------+---------------+-----------------+--------------+
+|           1 |             1 |               1 |         NULL |
++-------------+---------------+-----------------+--------------+
+```
+
+### Window function:
+The following example partitions the rows based on the condition (id > 2), 
+divides them into two groups, and displays the window aggregation results:
+```sql
+SELECT * FROM test_boolean_agg;
+```
+```text
++------+------+------+------+------+
+| id   | c1   | c2   | c3   | c4   |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+```sql
+SELECT
+    id,
+    BOOLOR_AGG(c1) OVER (PARTITION BY (id > 2)) AS a,
+    BOOLOR_AGG(c2) OVER (PARTITION BY (id > 2)) AS b,
+    BOOLOR_AGG(c3) OVER (PARTITION BY (id > 2)) AS c,
+    BOOLOR_AGG(c4) OVER (PARTITION BY (id > 2)) AS d
+FROM test_boolean_agg
+ORDER BY id;
+```
+```text
++------+------+------+------+------+
+| id   | a    | b    | c    | d    |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    1 |    1 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    1 |    0 |    0 |
++------+------+------+------+------+
+```
+
+### Error example:
+```sql
+SELECT BOOL_OR('invalid type');
+```
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = bool_or requires a boolean or 
numeric argument
+```
\ No newline at end of file
diff --git a/docs/sql-manual/sql-functions/aggregate-functions/bool-xor.md 
b/docs/sql-manual/sql-functions/aggregate-functions/bool-xor.md
new file mode 100644
index 00000000000..346c9c4fec9
--- /dev/null
+++ b/docs/sql-manual/sql-functions/aggregate-functions/bool-xor.md
@@ -0,0 +1,146 @@
+---
+{
+"title": "BOOL_XOR",
+"language": "en"
+}
+---
+
+## Description
+
+Performs a logical XOR aggregation over all non-NULL values of the expression.
+
+## Alias
+
+- BOOLXOR_AGG
+
+## Syntax
+
+```text
+BOOL_XOR(<expr>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| -- | -- |
+| `<expr>` | Expression to be aggregated with logical XOR. Supports BOOLEAN 
type and numeric types that can be converted to boolean by the 0/non-0 rule (0 
is FALSE, non-0 is TRUE). |
+
+## Return Value
+
+The return value is BOOLEAN. It returns TRUE when there is only one TRUE among 
all non-NULL values, otherwise it returns FALSE.
+
+If all values of the expression are NULL or the expression is empty, the 
function returns NULL.
+
+## Examples
+
+Initialize table:
+```sql
+CREATE TABLE IF NOT EXISTS test_boolean_agg (
+     id INT,
+     c1 BOOLEAN,
+     c2 BOOLEAN,
+     c3 BOOLEAN,
+     c4 BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1"); 
+
+INSERT INTO test_boolean_agg (id, c1, c2, c3, c4) values 
+(1, true, true, true, false),
+(2, true, false, false, false),
+(3, true, true, false, false),
+(4, true, false, false, false);
+```
+
+### Aggregate function
+
+```sql
+SELECT BOOLXOR_AGG(c1), BOOLXOR_AGG(c2), BOOLXOR_AGG(c3), BOOLXOR_AGG(c4)
+FROM test_boolean_agg;
+```
+```text
++-----------------+-----------------+-----------------+-----------------+
+| BOOLXOR_AGG(c1) | BOOLXOR_AGG(c2) | BOOLXOR_AGG(c3) | BOOLXOR_AGG(c4) |
++-----------------+-----------------+-----------------+-----------------+
+|               0 |               0 |               1 |               0 |
++-----------------+-----------------+-----------------+-----------------+
+```
+
+BOOL_XOR also accepts numeric types; non-zero values are treated as TRUE:
+```sql
+CREATE TABLE test_numeric_and_null (
+    id INT,
+    c_int INT,
+    c_float FLOAT,
+    c_decimal DECIMAL(10,2),
+    c_bool BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_numeric_and_null (id, c_int, c_float, c_decimal, c_bool) 
VALUES
+(1, 1, 1.0, NULL, NULL),
+(2, 0, NULL, 0.00, NULL),
+(3, 1, 3.14, 1.00, NULL),
+(4, 0, 1.0, 0.00, NULL),
+(5, NULL, NULL, NULL, NULL);
+```
+
+```sql
+SELECT
+    BOOL_XOR(c_int) AS bool_xor_int,
+    BOOL_XOR(c_float) AS bool_xor_float,
+    BOOL_XOR(c_decimal) AS bool_xor_decimal,
+    BOOL_XOR(c_bool) AS bool_xor_bool
+FROM test_numeric_and_null;
+```
+```text
++--------------+----------------+------------------+---------------+
+| bool_xor_int | bool_xor_float | bool_xor_decimal | bool_xor_bool |
++--------------+----------------+------------------+---------------+
+|            0 |              0 |                1 |          NULL |
++--------------+----------------+------------------+---------------+
+```
+
+### Window function
+The following example partitions the rows based on the condition (id > 2), 
+divides them into two groups, and displays the window aggregation results:
+```sql
+SELECT * FROM test_boolean_agg;
+```
+```text
++------+------+------+------+------+
+| id   | c1   | c2   | c3   | c4   |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+```sql
+SELECT
+    id,
+    BOOLXOR_AGG(c1) OVER (PARTITION BY (id > 2)) AS a,
+    BOOLXOR_AGG(c2) OVER (PARTITION BY (id > 2)) AS b,
+    BOOLXOR_AGG(c3) OVER (PARTITION BY (id > 2)) AS c,
+    BOOLXOR_AGG(c4) OVER (PARTITION BY (id > 2)) AS d
+FROM test_boolean_agg
+ORDER BY id;
+```
+```text
++------+------+------+------+------+
+| id   | a    | b    | c    | d    |
++------+------+------+------+------+
+|    1 |    0 |    1 |    1 |    0 |
+|    2 |    0 |    1 |    1 |    0 |
+|    3 |    0 |    1 |    0 |    0 |
+|    4 |    0 |    1 |    0 |    0 |
++------+------+------+------+------+
+```
+
+### Error example:
+```sql
+SELECT BOOL_XOR('invalid type');
+```
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = bool_xor requires a boolean 
or numeric argument
+``` 
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-and.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-and.md
new file mode 100644
index 00000000000..61ed74c1aef
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-and.md
@@ -0,0 +1,146 @@
+---
+{
+"title": "BOOL_AND",
+"language": "zh-CN"
+}
+---
+
+## 描述
+
+对表达式中所有非 NULL 值执行逻辑与(AND)聚合计算。
+
+## 别名
+
+- BOOLAND_AGG
+
+## 语法
+
+```text
+BOOL_AND(<expr>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<expr>` | 参与逻辑与(AND)聚合的表达式。支持布尔类型,及可按 0/非 0 规则转换为布尔值的数值类型(0 为 FALSE,非 0 为 
TRUE)|
+
+## 返回值
+
+返回值为 BOOLEAN。仅当所有非 NULL 值均为 TRUE 时返回 TRUE, 否则返回 FALSE。
+
+如果表达式中所有的值都为 NULL 或表达式为空,则返回 NULL。
+
+
+## 举例
+
+初始化表:
+```sql
+CREATE TABLE IF NOT EXISTS test_boolean_agg (
+     id INT,
+     c1 BOOLEAN,
+     c2 BOOLEAN,
+     c3 BOOLEAN,
+     c4 BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1"); 
+
+INSERT INTO test_boolean_agg (id, c1, c2, c3, c4) values 
+(1, true, true, true, false),
+(2, true, false, false, false),
+(3, true, true, false, false),
+(4, true, false, false, false);
+```
+
+### 聚合函数
+
+```sql
+SELECT BOOLAND_AGG(c1), BOOLAND_AGG(c2), BOOLAND_AGG(c3), BOOLAND_AGG(c4)
+FROM test_boolean_agg;
+```
+```text
++-----------------+-----------------+-----------------+-----------------+
+| BOOLAND_AGG(c1) | BOOLAND_AGG(c2) | BOOLAND_AGG(c3) | BOOLAND_AGG(c4) |
++-----------------+-----------------+-----------------+-----------------+
+|               1 |               0 |               0 |               0 |
++-----------------+-----------------+-----------------+-----------------+
+```
+
+bool_and也可以接受数值类型的参数,如果数值不为 0,则将其转为 `TRUE`
+```sql
+CREATE TABLE test_numeric_and_null (
+    id INT,
+    c_int INT,
+    c_float FLOAT,
+    c_decimal DECIMAL(10,2),
+    c_bool BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_numeric_and_null (id, c_int, c_float, c_decimal, c_bool) 
VALUES
+(1, 1, 1.0, NULL, NULL),
+(2, 0, NULL, 0.00, NULL),
+(3, 1, 3.14, 1.00, NULL),
+(4, 0, 1.0, 0.00, NULL),
+(5, NULL, NULL, NULL, NULL);
+```
+
+```sql
+SELECT
+    BOOL_AND(c_int) AS bool_and_int,
+    BOOL_AND(c_float) AS bool_and_float,
+    BOOL_AND(c_decimal) AS bool_and_decimal,
+    BOOL_AND(c_bool) AS bool_and_bool
+FROM test_numeric_and_null;
+```
+```text
++--------------+----------------+------------------+---------------+
+| bool_and_int | bool_and_float | bool_and_decimal | bool_and_bool |
++--------------+----------------+------------------+---------------+
+|            0 |              1 |                0 |          NULL |
++--------------+----------------+------------------+---------------+
+```
+
+### 窗口函数
+下例按条件 (id > 2) 对行进行分区,将其划分为两组并展示窗口聚合结果:
+```sql
+SELECT * FROM test_boolean_agg;
+```
+```text
++------+------+------+------+------+
+| id   | c1   | c2   | c3   | c4   |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+```sql
+SELECT
+    id,
+    BOOLAND_AGG(c1) OVER (PARTITION BY (id > 2)) AS a,
+    BOOLAND_AGG(c2) OVER (PARTITION BY (id > 2)) AS b,
+    BOOLAND_AGG(c3) OVER (PARTITION BY (id > 2)) AS c,
+    BOOLAND_AGG(c4) OVER (PARTITION BY (id > 2)) AS d
+FROM test_boolean_agg
+ORDER BY id;
+```
+```text
++------+------+------+------+------+
+| id   | a    | b    | c    | d    |
++------+------+------+------+------+
+|    1 |    1 |    0 |    0 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    0 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+
+### 错误示例:
+```sql
+SELECT BOOL_AND('invalid type');
+```
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = bool_and requires a boolean 
or numeric argument
+```
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-or.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-or.md
new file mode 100644
index 00000000000..82807b3c663
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-or.md
@@ -0,0 +1,145 @@
+---
+{
+"title": "BOOL_OR",
+"language": "zh-CN"
+}
+---
+
+## 描述
+
+对表达式中所有非 NULL 值执行逻辑或(OR)聚合计算。
+
+## 别名
+
+- BOOLOR_AGG
+
+## 语法
+
+```text
+BOOL_OR(<expr>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<expr>` | 参与逻辑或(OR)聚合的表达式。支持布尔类型,及可按 0/非 0 规则转换为布尔值的数值类型(0 为 FALSE,非 0 为 
TRUE)|
+
+## 返回值
+
+返回值为 BOOLEAN。当所有非 NULL 值存在 TRUE 时返回 TRUE, 否则返回 FALSE。
+
+如果表达式中所有的值都为 NULL 或表达式为空,则返回 NULL。
+
+## 举例
+
+初始化表:
+```sql
+CREATE TABLE IF NOT EXISTS test_boolean_agg (
+     id INT,
+     c1 BOOLEAN,
+     c2 BOOLEAN,
+     c3 BOOLEAN,
+     c4 BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1"); 
+
+INSERT INTO test_boolean_agg (id, c1, c2, c3, c4) values 
+(1, true, true, true, false),
+(2, true, false, false, false),
+(3, true, true, false, false),
+(4, true, false, false, false);
+```
+
+### 聚合函数
+
+```sql
+SELECT BOOLOR_AGG(c1), BOOLOR_AGG(c2), BOOLOR_AGG(c3), BOOLOR_AGG(c4)
+FROM test_boolean_agg;
+```
+```text
++----------------+----------------+----------------+----------------+
+| BOOLOR_AGG(c1) | BOOLOR_AGG(c2) | BOOLOR_AGG(c3) | BOOLOR_AGG(c4) |
++----------------+----------------+----------------+----------------+
+|              1 |              1 |              1 |              0 |
++----------------+----------------+----------------+----------------+
+```
+
+bool_or也可以接受数值类型的参数,如果数值不为 0,则将其转为 `TRUE`
+```sql
+CREATE TABLE test_numeric_and_null (
+    id INT,
+    c_int INT,
+    c_float FLOAT,
+    c_decimal DECIMAL(10,2),
+    c_bool BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_numeric_and_null (id, c_int, c_float, c_decimal, c_bool) 
VALUES
+(1, 1, 1.0, NULL, NULL),
+(2, 0, NULL, 0.00, NULL),
+(3, 1, 3.14, 1.00, NULL),
+(4, 0, 1.0, 0.00, NULL),
+(5, NULL, NULL, NULL, NULL);
+```
+
+```sql
+SELECT
+    BOOL_OR(c_int) AS bool_or_int,
+    BOOL_OR(c_float) AS bool_or_float,
+    BOOL_OR(c_decimal) AS bool_or_decimal,
+    BOOL_OR(c_bool) AS bool_or_bool
+FROM test_numeric_and_null;
+```
+```text
++-------------+---------------+-----------------+--------------+
+| bool_or_int | bool_or_float | bool_or_decimal | bool_or_bool |
++-------------+---------------+-----------------+--------------+
+|           1 |             1 |               1 |         NULL |
++-------------+---------------+-----------------+--------------+
+```
+
+### 窗口函数
+下例按条件 (id > 2) 对行进行分区,将其划分为两组并展示窗口聚合结果:
+```sql
+SELECT * FROM test_boolean_agg;
+```
+```text
++------+------+------+------+------+
+| id   | c1   | c2   | c3   | c4   |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+```sql
+SELECT
+    id,
+    BOOLOR_AGG(c1) OVER (PARTITION BY (id > 2)) AS a,
+    BOOLOR_AGG(c2) OVER (PARTITION BY (id > 2)) AS b,
+    BOOLOR_AGG(c3) OVER (PARTITION BY (id > 2)) AS c,
+    BOOLOR_AGG(c4) OVER (PARTITION BY (id > 2)) AS d
+FROM test_boolean_agg
+ORDER BY id;
+```
+```text
++------+------+------+------+------+
+| id   | a    | b    | c    | d    |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    1 |    1 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    1 |    0 |    0 |
++------+------+------+------+------+
+```
+
+### 错误示例:
+```sql
+SELECT BOOL_OR('invalid type');
+```
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = bool_or requires a boolean or 
numeric argument
+```
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-xor.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-xor.md
new file mode 100644
index 00000000000..eb7d96f1776
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/bool-xor.md
@@ -0,0 +1,145 @@
+---
+{
+"title": "BOOL_XOR",
+"language": "zh-CN"
+}
+---
+
+## 描述
+
+对表达式中所有非 NULL 值执行逻辑异或(XOR)聚合计算。
+
+## 别名
+
+- BOOLXOR_AGG
+
+## 语法
+
+```text
+BOOL_XOR(<expr>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<expr>` | 参与逻辑异或(XOR)聚合的表达式。支持布尔类型,及可按 0/非 0 规则转换为布尔值的数值类型(0 为 FALSE,非 0 为 
TRUE)|
+
+## 返回值
+
+返回值为 BOOLEAN。当所有非 NULL 值仅有一个 TRUE 时返回 TRUE, 否则返回 FALSE。
+
+如果表达式中所有的值都为 NULL 或表达式为空,则返回 NULL。
+
+## 举例
+
+初始化表:
+```sql
+CREATE TABLE IF NOT EXISTS test_boolean_agg (
+     id INT,
+     c1 BOOLEAN,
+     c2 BOOLEAN,
+     c3 BOOLEAN,
+     c4 BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1"); 
+
+INSERT INTO test_boolean_agg (id, c1, c2, c3, c4) values 
+(1, true, true, true, false),
+(2, true, false, false, false),
+(3, true, true, false, false),
+(4, true, false, false, false);
+```
+
+### 聚合函数
+
+```sql
+SELECT BOOLXOR_AGG(c1), BOOLXOR_AGG(c2), BOOLXOR_AGG(c3), BOOLXOR_AGG(c4)
+FROM test_boolean_agg;
+```
+```text
++-----------------+-----------------+-----------------+-----------------+
+| BOOLXOR_AGG(c1) | BOOLXOR_AGG(c2) | BOOLXOR_AGG(c3) | BOOLXOR_AGG(c4) |
++-----------------+-----------------+-----------------+-----------------+
+|               0 |               0 |               1 |               0 |
++-----------------+-----------------+-----------------+-----------------+
+```
+
+bool_xor也可以接受数值类型的参数,如果数值不为 0,则将其转为 `TRUE`
+```sql
+CREATE TABLE test_numeric_and_null (
+    id INT,
+    c_int INT,
+    c_float FLOAT,
+    c_decimal DECIMAL(10,2),
+    c_bool BOOLEAN
+) DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_numeric_and_null (id, c_int, c_float, c_decimal, c_bool) 
VALUES
+(1, 1, 1.0, NULL, NULL),
+(2, 0, NULL, 0.00, NULL),
+(3, 1, 3.14, 1.00, NULL),
+(4, 0, 1.0, 0.00, NULL),
+(5, NULL, NULL, NULL, NULL);
+```
+
+```sql
+SELECT
+    BOOL_XOR(c_int) AS bool_xor_int,
+    BOOL_XOR(c_float) AS bool_xor_float,
+    BOOL_XOR(c_decimal) AS bool_xor_decimal,
+    BOOL_XOR(c_bool) AS bool_xor_bool
+FROM test_numeric_and_null;
+```
+```text
++--------------+----------------+------------------+---------------+
+| bool_xor_int | bool_xor_float | bool_xor_decimal | bool_xor_bool |
++--------------+----------------+------------------+---------------+
+|            0 |              0 |                1 |          NULL |
++--------------+----------------+------------------+---------------+
+```
+
+### 窗口函数
+下例按条件 (id > 2) 对行进行分区,将其划分为两组并展示窗口聚合结果:
+```sql
+SELECT * FROM test_boolean_agg;
+```
+```text
++------+------+------+------+------+
+| id   | c1   | c2   | c3   | c4   |
++------+------+------+------+------+
+|    1 |    1 |    1 |    1 |    0 |
+|    2 |    1 |    0 |    0 |    0 |
+|    3 |    1 |    1 |    0 |    0 |
+|    4 |    1 |    0 |    0 |    0 |
++------+------+------+------+------+
+```
+```sql
+SELECT
+    id,
+    BOOLXOR_AGG(c1) OVER (PARTITION BY (id > 2)) AS a,
+    BOOLXOR_AGG(c2) OVER (PARTITION BY (id > 2)) AS b,
+    BOOLXOR_AGG(c3) OVER (PARTITION BY (id > 2)) AS c,
+    BOOLXOR_AGG(c4) OVER (PARTITION BY (id > 2)) AS d
+FROM test_boolean_agg
+ORDER BY id;
+```
+```text
++------+------+------+------+------+
+| id   | a    | b    | c    | d    |
++------+------+------+------+------+
+|    1 |    0 |    1 |    1 |    0 |
+|    2 |    0 |    1 |    1 |    0 |
+|    3 |    0 |    1 |    0 |    0 |
+|    4 |    0 |    1 |    0 |    0 |
++------+------+------+------+------+
+```
+
+### 错误示例:
+```sql
+SELECT BOOL_XOR('invalid type');
+```
+```text
+ERROR 1105 (HY000): errCode = 2, detailMessage = bool_xor requires a boolean 
or numeric argument
+```
\ No newline at end of file
diff --git a/sidebars.json b/sidebars.json
index dd7841d6d50..67c8add69f6 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1751,6 +1751,9 @@
                                 
"sql-manual/sql-functions/aggregate-functions/bitmap-union",
                                 
"sql-manual/sql-functions/aggregate-functions/bitmap-union-count",
                                 
"sql-manual/sql-functions/aggregate-functions/bitmap-union-int",
+                                
"sql-manual/sql-functions/aggregate-functions/bool-and",
+                                
"sql-manual/sql-functions/aggregate-functions/bool-or",
+                                
"sql-manual/sql-functions/aggregate-functions/bool-xor",
                                 
"sql-manual/sql-functions/aggregate-functions/collect-list",
                                 
"sql-manual/sql-functions/aggregate-functions/collect-set",
                                 
"sql-manual/sql-functions/aggregate-functions/corr-welford",
@@ -1837,6 +1840,9 @@
                                 
"sql-manual/sql-functions/aggregate-functions/bitmap-union",
                                 
"sql-manual/sql-functions/aggregate-functions/bitmap-union-count",
                                 
"sql-manual/sql-functions/aggregate-functions/bitmap-union-int",
+                                
"sql-manual/sql-functions/aggregate-functions/bool-and",
+                                
"sql-manual/sql-functions/aggregate-functions/bool-or",
+                                
"sql-manual/sql-functions/aggregate-functions/bool-xor",
                                 
"sql-manual/sql-functions/aggregate-functions/collect-list",
                                 
"sql-manual/sql-functions/aggregate-functions/collect-set",
                                 
"sql-manual/sql-functions/aggregate-functions/corr-welford",


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

Reply via email to