You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "yagagagaga (via GitHub)" <gi...@apache.org> on 2023/02/17 10:42:10 UTC
[GitHub] [doris] yagagagaga opened a new pull request, #16884: [typo](docs)supplement the document content
yagagagaga opened a new pull request, #16884:
URL: https://github.com/apache/doris/pull/16884
# Proposed changes
Issue Number: close #xxx
## Problem summary
The original document is too simple, so I made some additions.
## Checklist(Required)
* [ ] Does it affect the original behavior
* [ ] Has unit tests been added
* [x] Has document been added or modified
* [ ] Does it need to update dependencies
* [x] Is this PR support rollback (If NO, please explain WHY)
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yagagagaga commented on a diff in pull request #16884: [typo](docs)supplement the document content
Posted by "yagagagaga (via GitHub)" <gi...@apache.org>.
yagagagaga commented on code in PR #16884:
URL: https://github.com/apache/doris/pull/16884#discussion_r1109644910
##########
docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/grouping.md:
##########
@@ -25,25 +25,82 @@ under the License.
-->
## GROUPING
-### description
-#### Syntax
-`GROUPING(expr)`
+用在含有 CUBE、ROLLUP 或 GROUPING SETS 的SQL语句中,用于表示进行 CUBE、ROLLUP 或 GROUPING SETS 操作的列是否汇总。当结果集中的数据行是 CUBE、ROLLUP 或 GROUPING SETS 操作产生的汇总结果时,该函数返回 1,否则返回 0。GROUPING 函数可以在 `SELECT`、`HAVING` 和 `ORDER BY` 子句当中使用。
Review Comment:
I have made corrections.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16884: [typo](docs)supplement the document content
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16884:
URL: https://github.com/apache/doris/pull/16884#issuecomment-1434527999
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yagagagaga commented on a diff in pull request #16884: [typo](docs)supplement the document content
Posted by "yagagagaga (via GitHub)" <gi...@apache.org>.
yagagagaga commented on code in PR #16884:
URL: https://github.com/apache/doris/pull/16884#discussion_r1109642877
##########
docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/grouping.md:
##########
@@ -25,25 +25,82 @@ under the License.
-->
## GROUPING
-### description
-#### Syntax
-`GROUPING(expr)`
+用在含有 CUBE、ROLLUP 或 GROUPING SETS 的SQL语句中,用于表示进行 CUBE、ROLLUP 或 GROUPING SETS 操作的列是否汇总。当结果集中的数据行是 CUBE、ROLLUP 或 GROUPING SETS 操作产生的汇总结果时,该函数返回 1,否则返回 0。GROUPING 函数可以在 `SELECT`、`HAVING` 和 `ORDER BY` 子句当中使用。
-GROUPING用在含有CUBE 或 ROLLUP 语句的SQL语句中,当结果集中的数据行是由CUBE 或 ROLLUP 运算产生的则该函数返回1,否则返回0。
+### 语法
-### example
+```sql
+GROUPING( <column_expression> )
```
-MySQL > SELECT COL1,GROUPING(COL2) AS 'Grouping' FROM tbl GROUP BY ROLLUP (COL1, COL2);
-+------+----------+
-| COL1 | Grouping |
-+------+----------+
-| NULL | 1 |
-| 2.20 | 1 |
-| 2.20 | 0 |
-| 1.10 | 1 |
-| 1.10 | 0 |
-+------+----------+
+
+### 参数
+
+`<column_expression>`
+是在 `GROUP BY` 子句中包含的列或表达式。
+
+### 返回类型
+
+BIGINT
+
+### 备注
+
+`ROLLUP`、`CUBE` 或 `GROUPING SETS` 操作返回的汇总结果,会用 NULL 充当被分组的字段的值。因此,`GROUPING` 通常用于区分 `ROLLUP`、`CUBE` 或 `GROUPING SETS` 返回的空值与表中的空值。
+
+### 示例
+
+下面的例子使用 `camp` 列进行分组操作,并对 `occupation` 的数量进行汇总,`GROUPING` 函数作用于 `camp` 列。
+
+```sql
+CREATE TABLE `roles` (
+ role_id INT,
+ occupation VARCHAR(32),
+ camp VARCHAR(32),
+ register_time DATE
+)
+UNIQUE KEY(role_id)
+DISTRIBUTED BY HASH(role_id) BUCKETS 1
+PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+);
+
+INSERT INTO `roles` VALUES
+(0, 'who am I', NULL, NULL),
+(1, 'mage', 'alliance', '2018-12-03 16:11:28'),
+(2, 'paladin', 'alliance', '2018-11-30 16:11:28'),
+(3, 'rogue', 'horde', '2018-12-01 16:11:28'),
+(4, 'priest', 'alliance', '2018-12-02 16:11:28'),
+(5, 'shaman', 'horde', NULL),
+(6, 'warrior', 'alliance', NULL),
+(7, 'warlock', 'horde', '2018-12-04 16:11:28'),
+(8, 'hunter', 'horde', NULL);
+
+SELECT
+ camp,
+ COUNT(occupation) AS 'occ_cnt',
+ GROUPING(camp) AS 'grouping'
+FROM
+ `roles`
+GROUP BY
+ ROLLUP(camp); -- CUBE(camp) 和 GROUPING SETS((camp)) 同样也有效;
+```
+
+结果集在 `camp` 列下有两个 NULL 值,第一个 NULL 值表示 `ROLLUP` 操作的列的汇总结果,这一行的 `occ_cnt` 列表示所有 `camp` 的 `occupation` 的计数结果,在 `grouping` 函数中返回 1。第二个 NULL 表示 `camp` 列中本来就存在的 null 值。
Review Comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16884: [typo](docs)supplement the document content
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16884:
URL: https://github.com/apache/doris/pull/16884#issuecomment-1434528048
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yiguolei merged pull request #16884: [typo](docs)supplement the document content
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei merged PR #16884:
URL: https://github.com/apache/doris/pull/16884
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yagagagaga commented on a diff in pull request #16884: [typo](docs)supplement the document content
Posted by "yagagagaga (via GitHub)" <gi...@apache.org>.
yagagagaga commented on code in PR #16884:
URL: https://github.com/apache/doris/pull/16884#discussion_r1109644590
##########
docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/grouping.md:
##########
@@ -25,25 +25,82 @@ under the License.
-->
## GROUPING
-### description
-#### Syntax
-`GROUPING(expr)`
+用在含有 CUBE、ROLLUP 或 GROUPING SETS 的SQL语句中,用于表示进行 CUBE、ROLLUP 或 GROUPING SETS 操作的列是否汇总。当结果集中的数据行是 CUBE、ROLLUP 或 GROUPING SETS 操作产生的汇总结果时,该函数返回 1,否则返回 0。GROUPING 函数可以在 `SELECT`、`HAVING` 和 `ORDER BY` 子句当中使用。
Review Comment:
I have made corrections.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] luzhijing commented on a diff in pull request #16884: [typo](docs)supplement the document content
Posted by "luzhijing (via GitHub)" <gi...@apache.org>.
luzhijing commented on code in PR #16884:
URL: https://github.com/apache/doris/pull/16884#discussion_r1109620995
##########
docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/grouping.md:
##########
@@ -25,25 +25,82 @@ under the License.
-->
## GROUPING
-### description
-#### Syntax
-`GROUPING(expr)`
+用在含有 CUBE、ROLLUP 或 GROUPING SETS 的SQL语句中,用于表示进行 CUBE、ROLLUP 或 GROUPING SETS 操作的列是否汇总。当结果集中的数据行是 CUBE、ROLLUP 或 GROUPING SETS 操作产生的汇总结果时,该函数返回 1,否则返回 0。GROUPING 函数可以在 `SELECT`、`HAVING` 和 `ORDER BY` 子句当中使用。
Review Comment:
add space after and before English letters in CN docs
##########
docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/grouping.md:
##########
@@ -25,25 +25,82 @@ under the License.
-->
## GROUPING
-### description
-#### Syntax
-`GROUPING(expr)`
+用在含有 CUBE、ROLLUP 或 GROUPING SETS 的SQL语句中,用于表示进行 CUBE、ROLLUP 或 GROUPING SETS 操作的列是否汇总。当结果集中的数据行是 CUBE、ROLLUP 或 GROUPING SETS 操作产生的汇总结果时,该函数返回 1,否则返回 0。GROUPING 函数可以在 `SELECT`、`HAVING` 和 `ORDER BY` 子句当中使用。
Review Comment:
add space before and after English letters in CN docs
##########
docs/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/grouping.md:
##########
@@ -25,25 +25,82 @@ under the License.
-->
## GROUPING
-### description
-#### Syntax
-`GROUPING(expr)`
+用在含有 CUBE、ROLLUP 或 GROUPING SETS 的SQL语句中,用于表示进行 CUBE、ROLLUP 或 GROUPING SETS 操作的列是否汇总。当结果集中的数据行是 CUBE、ROLLUP 或 GROUPING SETS 操作产生的汇总结果时,该函数返回 1,否则返回 0。GROUPING 函数可以在 `SELECT`、`HAVING` 和 `ORDER BY` 子句当中使用。
-GROUPING用在含有CUBE 或 ROLLUP 语句的SQL语句中,当结果集中的数据行是由CUBE 或 ROLLUP 运算产生的则该函数返回1,否则返回0。
+### 语法
-### example
+```sql
+GROUPING( <column_expression> )
```
-MySQL > SELECT COL1,GROUPING(COL2) AS 'Grouping' FROM tbl GROUP BY ROLLUP (COL1, COL2);
-+------+----------+
-| COL1 | Grouping |
-+------+----------+
-| NULL | 1 |
-| 2.20 | 1 |
-| 2.20 | 0 |
-| 1.10 | 1 |
-| 1.10 | 0 |
-+------+----------+
+
+### 参数
+
+`<column_expression>`
+是在 `GROUP BY` 子句中包含的列或表达式。
+
+### 返回类型
+
+BIGINT
+
+### 备注
+
+`ROLLUP`、`CUBE` 或 `GROUPING SETS` 操作返回的汇总结果,会用 NULL 充当被分组的字段的值。因此,`GROUPING` 通常用于区分 `ROLLUP`、`CUBE` 或 `GROUPING SETS` 返回的空值与表中的空值。
+
+### 示例
+
+下面的例子使用 `camp` 列进行分组操作,并对 `occupation` 的数量进行汇总,`GROUPING` 函数作用于 `camp` 列。
+
+```sql
+CREATE TABLE `roles` (
+ role_id INT,
+ occupation VARCHAR(32),
+ camp VARCHAR(32),
+ register_time DATE
+)
+UNIQUE KEY(role_id)
+DISTRIBUTED BY HASH(role_id) BUCKETS 1
+PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+);
+
+INSERT INTO `roles` VALUES
+(0, 'who am I', NULL, NULL),
+(1, 'mage', 'alliance', '2018-12-03 16:11:28'),
+(2, 'paladin', 'alliance', '2018-11-30 16:11:28'),
+(3, 'rogue', 'horde', '2018-12-01 16:11:28'),
+(4, 'priest', 'alliance', '2018-12-02 16:11:28'),
+(5, 'shaman', 'horde', NULL),
+(6, 'warrior', 'alliance', NULL),
+(7, 'warlock', 'horde', '2018-12-04 16:11:28'),
+(8, 'hunter', 'horde', NULL);
+
+SELECT
+ camp,
+ COUNT(occupation) AS 'occ_cnt',
+ GROUPING(camp) AS 'grouping'
+FROM
+ `roles`
+GROUP BY
+ ROLLUP(camp); -- CUBE(camp) 和 GROUPING SETS((camp)) 同样也有效;
+```
+
+结果集在 `camp` 列下有两个 NULL 值,第一个 NULL 值表示 `ROLLUP` 操作的列的汇总结果,这一行的 `occ_cnt` 列表示所有 `camp` 的 `occupation` 的计数结果,在 `grouping` 函数中返回 1。第二个 NULL 表示 `camp` 列中本来就存在的 null 值。
Review Comment:
null -> NULL, keep the English case consistent
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org