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

support GROUP BY modifiers #4250

Closed
zz-jason opened this issue Aug 19, 2017 · 8 comments
Closed

support GROUP BY modifiers #4250

zz-jason opened this issue Aug 19, 2017 · 8 comments
Assignees
Labels
feature/accepted This feature request is accepted by product managers help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/execution SIG execution type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@zz-jason
Copy link
Member

zz-jason commented Aug 19, 2017

Request Description

MySQL and Oracle support ROLLUP modifier, SQL Server also supports CUBE and GROUPING SETS

References:

An example in MySQL:

drop table if exists t;
create table t(a bigint, b bigint, c bigint);
insert into t values(1, 2, 3), (2, 2, 3), (3, 2, 3);
MySQL > select a, min(b) from t group by a with rollup;
+------+--------+
| a    | min(b) |
+------+--------+
|    1 |      2 |
|    2 |      2 |
|    3 |      2 |
| NULL |      2 |
+------+--------+
4 rows in set (0.01 sec)

Category

Feature

Value

  • Value Point: 2

It's hard to tell the value for now. Quoted from https://docs.oracle.com/cd/F49540_01/DOC/server.815/a68003/rollup_c.htm:

One of the key concepts in decision support systems is "multi-dimensional analysis": examining the enterprise from all necessary combinations of dimensions. We use the term "dimension" to mean any category used in specifying questions. Among the most commonly specified dimensions are time, geography, product, department, and distribution channel, but the potential dimensions are as endless as the varieties of enterprise activity. The events or entities associated with a particular set of dimension values are usually referred to as "facts." The facts may be sales in units or local currency, profits, customer counts, production volumes, or anything else worth tracking.

I think the value of this request is to improve the usability and performance in Business Intelligence(BI) scenarios. No need to run several aggregate queries to get another level aggregate result. I'm curious about whether are some BI tools rely on this feature.

Workload Estimation

Workload contains coding, documenting, and testing.
1 Point for 1 Person/Work Day

  • 60 Points, hard to say, most modifications are on the aggregate operator in execution engine.
@zz-jason zz-jason added type/compatibility type/enhancement The issue or PR belongs to an enhancement. todo labels Aug 19, 2017
@zz-jason zz-jason self-assigned this Aug 19, 2017
@Lloyd-longfei
Copy link

My also encountered the same problem with TIDB, and when writing SQL, the following mistakes were made:

Error : line 83 column 35 near " rollup" (total length 3865) 

This problem may directly affect the running of our online production environment, when can you increase the function, or tell us how to solve the problem. @hanfei1991

@zz-jason
Copy link
Member Author

zz-jason commented Mar 8, 2018

@Lloyd-longfei Thanks for your feed back, I'm sorry to tell you that group by ... with rollup is not on our roadmap now, but we'll support it as soon as possible.

For now, a workaround is to write another sql to get the aggregation summary, see https://dev.mysql.com/doc/refman/5.7/en/group-by-modifiers.html for more detail.

@zz-jason zz-jason added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Mar 18, 2018
@morgo
Copy link
Contributor

morgo commented Dec 29, 2018

Confirming that this feature is still missing:

mysql> select a, min(b) from t group by a with rollup;
ERROR 1105 (HY000): line 1 column 39 near " rollup" (total length 46)
mysql> select tidb_version();
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                      |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v2.1.0-rc.3-385-gbb0e7a18f
Git Commit Hash: bb0e7a18f63b12b167eb1c5ba58bcf4cb6ea7a1b
Git Branch: socket
UTC Build Time: 2018-12-29 10:14:15
GoVersion: go version go1.11.4 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

@vkingnew
Copy link

this feature is still not support as tidb 2.1.7,and which version to support ROLLUP and CUBE

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v2.1.7
Git Commit Hash: f5b52cb
Git Branch: HEAD
UTC Build Time: 2019-03-28 07:54:41
GoVersion: go version go1.11.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
1 row in set (0.00 sec)

@zz-jason zz-jason added type/feature-request Categorizes issue or PR as related to a new feature. and removed status/TODO type/compatibility type/enhancement The issue or PR belongs to an enhancement. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Mar 23, 2020
@zz-jason zz-jason added sig/execution SIG execution sig/planner SIG: Planner labels Apr 3, 2020
@zz-jason zz-jason removed their assignment Apr 3, 2020
@zz-jason zz-jason removed the sig/planner SIG: Planner label Jul 14, 2020
@zz-jason zz-jason added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jul 21, 2020
@scsldb scsldb added the feature/accepted This feature request is accepted by product managers label Jul 21, 2020
@bhzhu203
Copy link

bhzhu203 commented May 6, 2021

TiDB-v5.0.0 still does not support the "ROLLUP" fuction. Our product managers and staff managers like to write the BI statistics queries with the "ROLLUP" fuction , and hard to remove all of the "ROLLUP" from the losts of queries .
The replacement of the "ROLLUP" fuction costs a lot. The "ROLLUP" fuction exists in our BI queries over 40% . We still using the slow mysql instance because that. Hope TiDB will support "ROLLUP" . Thanks

rollup-sample.sql.gz

@Enochack
Copy link

/pick

@Enochack
Copy link

/assign

@Defined2014
Copy link
Contributor

We already supported rollup right now, ref #42631 . So close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/execution SIG execution type/feature-request Categorizes issue or PR as related to a new feature.
Projects
Status: Finished
Development

No branches or pull requests

8 participants