Skip to content

Conversation

@Jibing-Li
Copy link
Contributor

What problem does this PR solve?

Support GROUP BY ... WITH ROLLUP syntax

mysql> SELECT    year,   month,  SUM(amount) AS total_amount FROM sales GROUP BY year, month WITH ROLLUP order by year desc, month desc;
+------+-------+--------------+
| year | month | total_amount |
+------+-------+--------------+
| 2024 |     1 |      3400.00 |
| 2024 |  NULL |      3400.00 |
| 2023 |     2 |      4000.00 |
| 2023 |     1 |      3000.00 |
| 2023 |  NULL |      7000.00 |
| NULL |  NULL |     10400.00 |
+------+-------+--------------+
6 rows in set (0.02 sec)

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Jibing-Li Jibing-Li marked this pull request as ready for review June 19, 2025 09:27
@Jibing-Li
Copy link
Contributor Author

run buildall

@morrySnow morrySnow added usercase Important user case type label dev/2.1.x dev/3.0.x dev/3.1.x labels Jun 19, 2025
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jun 19, 2025
@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@doris-robot
Copy link

TPC-H: Total hot run time: 33889 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 79f07ca34fccef9e9ed3cf85cccab3d137be47d4, data reload: false

------ Round 1 ----------------------------------
q1	17653	5168	5026	5026
q2	1920	294	187	187
q3	10381	1377	707	707
q4	10256	1010	526	526
q5	7947	2364	2315	2315
q6	184	162	130	130
q7	901	746	622	622
q8	9327	1291	1100	1100
q9	6777	5117	5078	5078
q10	6937	2375	1981	1981
q11	473	296	265	265
q12	342	359	209	209
q13	17779	3647	3151	3151
q14	245	229	208	208
q15	564	484	492	484
q16	434	430	376	376
q17	608	846	364	364
q18	7552	7100	7049	7049
q19	1814	965	581	581
q20	348	333	234	234
q21	4020	2566	2335	2335
q22	1033	1009	961	961
Total cold run time: 107495 ms
Total hot run time: 33889 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5186	5097	5132	5097
q2	244	326	232	232
q3	2132	2677	2242	2242
q4	1355	1778	1379	1379
q5	4230	4112	4317	4112
q6	205	168	132	132
q7	2005	1922	1738	1738
q8	2572	2506	2525	2506
q9	7129	7108	7148	7108
q10	3080	3207	2835	2835
q11	591	501	495	495
q12	667	767	641	641
q13	3557	3943	3313	3313
q14	290	304	300	300
q15	514	491	472	472
q16	447	484	452	452
q17	1193	1525	1386	1386
q18	7486	7112	7049	7049
q19	795	813	837	813
q20	1898	1969	1807	1807
q21	4677	4440	4289	4289
q22	1050	1043	998	998
Total cold run time: 51303 ms
Total hot run time: 49396 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 185184 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 79f07ca34fccef9e9ed3cf85cccab3d137be47d4, data reload: false

query1	1012	396	406	396
query2	6517	1792	1878	1792
query3	6745	226	218	218
query4	26456	23842	22994	22994
query5	4399	630	460	460
query6	331	211	205	205
query7	4622	498	294	294
query8	267	236	217	217
query9	8626	2604	2620	2604
query10	480	325	280	280
query11	15203	15029	14760	14760
query12	159	111	106	106
query13	1657	525	410	410
query14	9141	6135	6205	6135
query15	201	188	169	169
query16	7318	615	450	450
query17	1190	720	563	563
query18	1971	408	313	313
query19	190	184	160	160
query20	126	125	112	112
query21	214	130	112	112
query22	3992	4179	3893	3893
query23	33954	33076	33157	33076
query24	8449	2319	2410	2319
query25	559	449	402	402
query26	1220	265	153	153
query27	2770	500	341	341
query28	4310	2105	2084	2084
query29	756	547	454	454
query30	287	219	195	195
query31	985	835	735	735
query32	71	64	65	64
query33	557	357	314	314
query34	788	870	522	522
query35	791	873	749	749
query36	968	968	890	890
query37	105	96	70	70
query38	4089	4128	4111	4111
query39	1481	1441	1409	1409
query40	212	122	107	107
query41	64	59	58	58
query42	124	106	104	104
query43	502	528	473	473
query44	1328	835	821	821
query45	184	171	169	169
query46	840	1013	626	626
query47	1732	1804	1765	1765
query48	384	413	301	301
query49	755	496	399	399
query50	657	677	409	409
query51	4187	4147	4084	4084
query52	105	105	99	99
query53	228	251	182	182
query54	568	559	489	489
query55	85	82	81	81
query56	313	305	303	303
query57	1178	1215	1130	1130
query58	274	259	263	259
query59	2716	2722	2693	2693
query60	314	322	318	318
query61	132	121	124	121
query62	795	709	647	647
query63	232	184	183	183
query64	4334	1000	669	669
query65	4279	4161	4195	4161
query66	1164	408	319	319
query67	15825	15513	15154	15154
query68	6818	876	509	509
query69	485	304	268	268
query70	1202	1099	1103	1099
query71	400	315	306	306
query72	5597	4766	4844	4766
query73	691	645	357	357
query74	9232	9151	8920	8920
query75	3213	3190	2688	2688
query76	3237	1192	756	756
query77	478	372	288	288
query78	9910	10175	9378	9378
query79	1071	818	579	579
query80	662	524	436	436
query81	492	261	222	222
query82	207	125	101	101
query83	252	261	246	246
query84	253	109	93	93
query85	839	431	391	391
query86	317	310	287	287
query87	4345	4472	4341	4341
query88	2885	2342	2279	2279
query89	378	308	283	283
query90	1760	209	202	202
query91	138	138	110	110
query92	63	61	58	58
query93	1009	930	573	573
query94	625	408	298	298
query95	430	290	286	286
query96	496	562	281	281
query97	2693	2772	2666	2666
query98	225	229	205	205
query99	1305	1374	1257	1257
Total cold run time: 268176 ms
Total hot run time: 185184 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 29.25 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 79f07ca34fccef9e9ed3cf85cccab3d137be47d4, data reload: false

query1	0.04	0.04	0.02
query2	0.07	0.04	0.03
query3	0.24	0.08	0.06
query4	1.61	0.10	0.11
query5	0.42	0.43	0.42
query6	1.17	0.64	0.67
query7	0.02	0.01	0.02
query8	0.04	0.04	0.03
query9	0.59	0.50	0.52
query10	0.56	0.58	0.56
query11	0.16	0.10	0.11
query12	0.15	0.12	0.13
query13	0.63	0.61	0.61
query14	0.80	0.82	0.81
query15	0.91	0.87	0.89
query16	0.39	0.38	0.37
query17	1.08	1.05	1.06
query18	0.22	0.21	0.21
query19	2.00	1.84	1.83
query20	0.01	0.01	0.01
query21	15.39	0.90	0.56
query22	0.75	1.14	0.74
query23	14.85	1.36	0.60
query24	7.58	1.18	0.48
query25	0.47	0.21	0.14
query26	0.68	0.16	0.13
query27	0.07	0.05	0.06
query28	9.23	0.89	0.45
query29	12.54	4.09	3.34
query30	0.25	0.09	0.07
query31	2.83	0.60	0.40
query32	3.23	0.55	0.48
query33	3.09	3.13	3.11
query34	15.79	5.44	4.74
query35	4.87	4.80	4.77
query36	0.71	0.50	0.53
query37	0.10	0.07	0.07
query38	0.05	0.04	0.04
query39	0.03	0.02	0.03
query40	0.18	0.15	0.14
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.05	0.03	0.03
Total cold run time: 103.96 s
Total hot run time: 29.25 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage `` 🎉
Increment coverage report
Complete coverage report

@morrySnow morrySnow merged commit 19b7b3a into apache:master Jun 19, 2025
29 of 33 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 19, 2025
### What problem does this PR solve?

Support GROUP BY ... WITH ROLLUP syntax

mysql> SELECT    year,   month,  SUM(amount) AS total_amount FROM sales GROUP BY year, month WITH ROLLUP order by year desc, month desc;
+------+-------+--------------+
| year | month | total_amount |
+------+-------+--------------+
| 2024 |     1 |      3400.00 |
| 2024 |  NULL |      3400.00 |
| 2023 |     2 |      4000.00 |
| 2023 |     1 |      3000.00 |
| 2023 |  NULL |      7000.00 |
| NULL |  NULL |     10400.00 |
+------+-------+--------------+
6 rows in set (0.02 sec)
github-actions bot pushed a commit that referenced this pull request Jun 19, 2025
### What problem does this PR solve?

Support GROUP BY ... WITH ROLLUP syntax

mysql> SELECT    year,   month,  SUM(amount) AS total_amount FROM sales GROUP BY year, month WITH ROLLUP order by year desc, month desc;
+------+-------+--------------+
| year | month | total_amount |
+------+-------+--------------+
| 2024 |     1 |      3400.00 |
| 2024 |  NULL |      3400.00 |
| 2023 |     2 |      4000.00 |
| 2023 |     1 |      3000.00 |
| 2023 |  NULL |      7000.00 |
| NULL |  NULL |     10400.00 |
+------+-------+--------------+
6 rows in set (0.02 sec)
@morrySnow morrySnow deleted the rollup branch June 19, 2025 12:23
github-actions bot pushed a commit that referenced this pull request Jun 19, 2025
### What problem does this PR solve?

Support GROUP BY ... WITH ROLLUP syntax

mysql> SELECT    year,   month,  SUM(amount) AS total_amount FROM sales GROUP BY year, month WITH ROLLUP order by year desc, month desc;
+------+-------+--------------+
| year | month | total_amount |
+------+-------+--------------+
| 2024 |     1 |      3400.00 |
| 2024 |  NULL |      3400.00 |
| 2023 |     2 |      4000.00 |
| 2023 |     1 |      3000.00 |
| 2023 |  NULL |      7000.00 |
| NULL |  NULL |     10400.00 |
+------+-------+--------------+
6 rows in set (0.02 sec)
morrySnow pushed a commit that referenced this pull request Jun 20, 2025
…ntax #51948 (#51979)

Cherry-picked from #51948

Co-authored-by: James <lijibing@selectdb.com>
dataroaring pushed a commit that referenced this pull request Jun 25, 2025
…ntax #51948 (#51977)

Cherry-picked from #51948

Co-authored-by: James <lijibing@selectdb.com>
yiguolei pushed a commit that referenced this pull request Jun 25, 2025
…ntax #51948 (#51978)

Cherry-picked from #51948

Co-authored-by: James <lijibing@selectdb.com>
@shuke987 shuke987 added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 16, 2025
BiteTheDDDDt pushed a commit to BiteTheDDDDt/incubator-doris that referenced this pull request Sep 1, 2025
…#51948) (apache#4151)

### What problem does this PR solve?

Support GROUP BY ... WITH ROLLUP syntax

mysql> SELECT year, month, SUM(amount) AS total_amount FROM sales GROUP
BY year, month WITH ROLLUP order by year desc, month desc;
+------+-------+--------------+
| year | month | total_amount |
+------+-------+--------------+
| 2024 |     1 |      3400.00 |
| 2024 |  NULL |      3400.00 |
| 2023 |     2 |      4000.00 |
| 2023 |     1 |      3000.00 |
| 2023 |  NULL |      7000.00 |
| NULL |  NULL |     10400.00 |
+------+-------+--------------+
6 rows in set (0.02 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/2.1.11-merged dev/3.0.7-merged dev/3.1.0-merged kind/feature Categorizes issue or PR as related to a new feature. reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants