Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust doc of combinator #1994

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/sql-manual/sql-functions/combinators/foreach.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ under the License.
## FOREACH
BiteTheDDDDt marked this conversation as resolved.
Show resolved Hide resolved

### description
#### Syntax

`AGGREGATE_FUNCTION_FOREACH(arg...)`
Converts an aggregate function for tables into an aggregate function for arrays that aggregates the corresponding array items and returns an array of results. For example, sum_foreach for the arrays [1, 2], [3, 4, 5]and[6, 7]returns the result [10, 13, 5] after adding together the corresponding array items.

#### Syntax


`AGGREGATE_FUNCTION_FOREACH(arg...)`

### example
```
Expand Down
6 changes: 4 additions & 2 deletions docs/sql-manual/sql-functions/combinators/merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## MERGE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要这个标题


### description
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里改成二级标题

#### Syntax

`AGGREGATE_FUNCTION_MERGE(agg_state)`
The aggregated intermediate results are aggregated and calculated to obtain the actual result.
The type of the result is consistent with `AGGREGATE_FUNCTION`.

#### Syntax

`AGGREGATE_FUNCTION_MERGE(agg_state)`

### example
```
mysql [test]>select avg_merge(avg_state(1)) from d_table;
Expand Down
6 changes: 4 additions & 2 deletions docs/sql-manual/sql-functions/combinators/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## STATE

### description
#### Syntax

`AGGREGATE_FUNCTION_STATE(arg...)`
Returns the intermediate result of the aggregation function, which can be used for subsequent aggregation or to obtain the actual calculation result through the merge combiner, or can be directly written into the agg_state type table and saved.
The type of the result is agg_state, and the function signature in agg_state is `AGGREGATE_FUNCTION(arg...)`.

#### Syntax

`AGGREGATE_FUNCTION_STATE(arg...)`

### example
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
6 changes: 4 additions & 2 deletions docs/sql-manual/sql-functions/combinators/union.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## UNION

### description
#### Syntax

`AGGREGATE_FUNCTION_UNION(agg_state)`
Aggregate multiple aggregation intermediate results into one.
The type of the result is agg_state, and the function signature is consistent with the input parameter.

#### Syntax

`AGGREGATE_FUNCTION_UNION(agg_state)`

### example
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ under the License.
## FOREACH

## 描述
将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sum_foreach` 对于数组 [1, 2], [3, 4, 5]和[6, 7]返回结果 [10, 13, 5] 之后将相应的数组项添加在一起。

## 语法

`AGGREGATE_FUNCTION_FOREACH(arg...)`
将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sum_foreach` 对于数组 [1, 2], [3, 4, 5]和[6, 7]返回结果 [10, 13, 5] 之后将相应的数组项添加在一起。


## 举例
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## MERGE

## 描述
## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`
将聚合中间结果进行聚合并计算获得实际结果。
结果的类型与`AGGREGATE_FUNCTION`一致。

## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`

## 举例
```
mysql [test]>select avg_merge(avg_state(1)) from d_table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## STATE

## 描述
## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`
返回聚合函数的中间结果,可以用于后续的聚合或者通过merge组合器获得实际计算结果,也可以直接写入agg_state类型的表保存下来。
结果的类型为agg_state,agg_state中的函数签名为`AGGREGATE_FUNCTION(arg...)`。

## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## UNION

## 描述
## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`
将多个聚合中间结果聚合为一个。
结果的类型为agg_state,函数签名与入参一致。

## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## MERGE

## 描述
## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`
将聚合中间结果进行聚合并计算获得实际结果。
结果的类型与`AGGREGATE_FUNCTION`一致。

## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`

## 举例
```
mysql [test]>select avg_merge(avg_state(1)) from d_table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## STATE

## 描述
## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`
返回聚合函数的中间结果,可以用于后续的聚合或者通过merge组合器获得实际计算结果,也可以直接写入agg_state类型的表保存下来。
结果的类型为agg_state,agg_state中的函数签名为`AGGREGATE_FUNCTION(arg...)`。

## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## UNION

## 描述
## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`
将多个聚合中间结果聚合为一个。
结果的类型为agg_state,函数签名与入参一致。

## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ under the License.
## FOREACH

## 描述
将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sum_foreach` 对于数组 [1, 2], [3, 4, 5]和[6, 7]返回结果 [10, 13, 5] 之后将相应的数组项添加在一起。

## 语法

`AGGREGATE_FUNCTION_FOREACH(arg...)`
将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sum_foreach` 对于数组 [1, 2], [3, 4, 5]和[6, 7]返回结果 [10, 13, 5] 之后将相应的数组项添加在一起。


## 举例
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## MERGE

## 描述
## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`
将聚合中间结果进行聚合并计算获得实际结果。
结果的类型与`AGGREGATE_FUNCTION`一致。

## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`

## 举例
```
mysql [test]>select avg_merge(avg_state(1)) from d_table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## STATE

## 描述
## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`
返回聚合函数的中间结果,可以用于后续的聚合或者通过merge组合器获得实际计算结果,也可以直接写入agg_state类型的表保存下来。
结果的类型为agg_state,agg_state中的函数签名为`AGGREGATE_FUNCTION(arg...)`。

## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## UNION

## 描述
## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`
将多个聚合中间结果聚合为一个。
结果的类型为agg_state,函数签名与入参一致。

## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ under the License.
## FOREACH

## 描述
将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sum_foreach` 对于数组 [1, 2], [3, 4, 5]和[6, 7]返回结果 [10, 13, 5] 之后将相应的数组项添加在一起。

## 语法

`AGGREGATE_FUNCTION_FOREACH(arg...)`
将表的聚合函数转换为聚合相应数组项并返回结果数组的数组的聚合函数。 例如, `sum_foreach` 对于数组 [1, 2], [3, 4, 5]和[6, 7]返回结果 [10, 13, 5] 之后将相应的数组项添加在一起。


## 举例
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## MERGE

## 描述
## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`
将聚合中间结果进行聚合并计算获得实际结果。
结果的类型与`AGGREGATE_FUNCTION`一致。

## 语法

`AGGREGATE_FUNCTION_MERGE(agg_state)`

## 举例
```
mysql [test]>select avg_merge(avg_state(1)) from d_table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## STATE

## 描述
## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`
返回聚合函数的中间结果,可以用于后续的聚合或者通过merge组合器获得实际计算结果,也可以直接写入agg_state类型的表保存下来。
结果的类型为agg_state,agg_state中的函数签名为`AGGREGATE_FUNCTION(arg...)`。

## 语法

`AGGREGATE_FUNCTION_STATE(arg...)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## UNION

## 描述
## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`
将多个聚合中间结果聚合为一个。
结果的类型为agg_state,函数签名与入参一致。

## 语法

`AGGREGATE_FUNCTION_UNION(agg_state)`

## 举例
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## MERGE

### description
#### Syntax

`AGGREGATE_FUNCTION_MERGE(agg_state)`
The aggregated intermediate results are aggregated and calculated to obtain the actual result.
The type of the result is consistent with `AGGREGATE_FUNCTION`.

#### Syntax

`AGGREGATE_FUNCTION_MERGE(agg_state)`

### example
```
mysql [test]>select avg_merge(avg_state(1)) from d_table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## STATE

### description
#### Syntax

`AGGREGATE_FUNCTION_STATE(arg...)`
Returns the intermediate result of the aggregation function, which can be used for subsequent aggregation or to obtain the actual calculation result through the merge combiner, or can be directly written into the agg_state type table and saved.
The type of the result is agg_state, and the function signature in agg_state is `AGGREGATE_FUNCTION(arg...)`.

#### Syntax

`AGGREGATE_FUNCTION_STATE(arg...)`

### example
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## UNION

### description
#### Syntax

`AGGREGATE_FUNCTION_UNION(agg_state)`
Aggregate multiple aggregation intermediate results into one.
The type of the result is agg_state, and the function signature is consistent with the input parameter.

#### Syntax

`AGGREGATE_FUNCTION_UNION(agg_state)`

### example
```
mysql [test]>select avg_merge(t) from (select avg_union(avg_state(1)) as t from d_table group by k1)p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ under the License.
## FOREACH

### description
#### Syntax

`AGGREGATE_FUNCTION_FOREACH(arg...)`
Converts an aggregate function for tables into an aggregate function for arrays that aggregates the corresponding array items and returns an array of results. For example, sum_foreach for the arrays [1, 2], [3, 4, 5]and[6, 7]returns the result [10, 13, 5] after adding together the corresponding array items.

#### Syntax


`AGGREGATE_FUNCTION_FOREACH(arg...)`

### example
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ under the License.
## MERGE

### description
#### Syntax

`AGGREGATE_FUNCTION_MERGE(agg_state)`
The aggregated intermediate results are aggregated and calculated to obtain the actual result.
The type of the result is consistent with `AGGREGATE_FUNCTION`.

#### Syntax

`AGGREGATE_FUNCTION_MERGE(agg_state)`

### example
```
mysql [test]>select avg_merge(avg_state(1)) from d_table;
Expand Down
Loading
Loading