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

[Fix](nereids) fix normalize repeat alias rewrite #38166

Merged
merged 5 commits into from
Jul 26, 2024

Conversation

feiniaofeiafei
Copy link
Contributor

@feiniaofeiafei feiniaofeiafei commented Jul 20, 2024

Induced by #34196.
In NormalizeRepeat, when NormalizeToSlot is called, aggregate function parameters, grouping scalar function parameters, and all expressions in grouping sets (including columns and column aliases) are pushed down to the lower-level project output.
In the previous PR #34196, the context was split into two, but the two contexts were not consistent. It is possible that the triplets in one context save (id, c1, id as c1), and the triplets in the other context save (id, id, id).
This causes id as c1 to be pushed down, but there is a reference to id in the upper-level LogicalRepeat, which causes the slot to be not found.
This pr has been modified.
If the same slot in the projection column has different aliases, for example,

select id as c1, id, id as c3, grouping(id) from table1 group by grouping sets((id, value2),(id));

then id as c1 (using the first alias) will be pushed down to the project.
In both the LogicalRepeat operator and the LogicalAggregate operator, c1 is referenced as the input slot, and id and c3 will not be used as input slots.

before NormalizeRepeat:
LogicalResultSink[32] ( outputExprs=[c1#3, id#0, c3#4, __grouping_3#5] )
+--LogicalRepeat ( groupingSets=[[id#0, value2#2], [id#0]], outputExpressions=[id#0 AS `c1`#3, id#0, id#0 AS `c3`#4, Grouping(id#0) AS `Grouping(id)`#5] )
   +--LogicalOlapScan (qualified=table1)
After NormalizeRepeat:
LogicalResultSink[33] (outputExprs=[c1#3, id#0, c3#4, __grouping_3#5])
+--LogicalAggregate[30] (groupByExpr=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)], outputExpr=[c1#3, c1#3 AS `id`#0, c1#3 AS `c3`#4, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3) AS `GROUPING_PREFIX_c1`#5], hasRepeat=true )
   +--LogicalRepeat (groupingSets=[[c1#3, value2#2], [c1#3]], outputExpressions=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)] )
      +--LogicalProject[28] (projects=[id#0 AS `c1`#3, value2#2])
         +--LogicalOlapScan (qualified=table1)

@doris-robot
Copy link

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

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@feiniaofeiafei
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17625	4337	4241	4241
q2	2004	196	184	184
q3	10435	1205	1059	1059
q4	10189	803	793	793
q5	7542	2758	2699	2699
q6	218	134	136	134
q7	947	605	599	599
q8	9216	2277	2076	2076
q9	8643	6566	6560	6560
q10	8835	3724	3744	3724
q11	452	237	240	237
q12	438	223	225	223
q13	17762	2976	2986	2976
q14	278	237	234	234
q15	516	469	483	469
q16	496	395	380	380
q17	965	647	657	647
q18	8111	7549	7465	7465
q19	5591	1382	1395	1382
q20	647	320	332	320
q21	4858	3229	3116	3116
q22	346	290	294	290
Total cold run time: 116114 ms
Total hot run time: 39808 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4341	4226	4213	4213
q2	368	259	269	259
q3	2983	2737	2878	2737
q4	1997	1778	1652	1652
q5	5589	5532	5462	5462
q6	225	135	135	135
q7	2148	1829	1889	1829
q8	3308	3418	3394	3394
q9	8756	8771	8951	8771
q10	4081	3926	3752	3752
q11	589	485	474	474
q12	809	653	664	653
q13	16221	3192	3194	3192
q14	320	295	298	295
q15	528	500	493	493
q16	497	442	430	430
q17	1778	1511	1511	1511
q18	8162	8041	7797	7797
q19	1750	1699	1661	1661
q20	2259	1863	1892	1863
q21	7828	4828	4939	4828
q22	580	509	519	509
Total cold run time: 75117 ms
Total hot run time: 55910 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 173341 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 029e51bddf17b66535193969130ab085a3986e09, data reload: false

query1	909	364	376	364
query2	6456	1807	1798	1798
query3	6642	207	218	207
query4	24720	17719	17285	17285
query5	3680	468	472	468
query6	270	172	166	166
query7	4592	282	280	280
query8	239	200	191	191
query9	8478	2441	2411	2411
query10	431	286	268	268
query11	11258	10298	10191	10191
query12	121	84	92	84
query13	1647	375	363	363
query14	9994	7586	7693	7586
query15	223	162	169	162
query16	7685	467	405	405
query17	1583	553	522	522
query18	1899	285	270	270
query19	194	147	150	147
query20	89	80	83	80
query21	201	131	119	119
query22	4650	4347	4349	4347
query23	34056	33709	33622	33622
query24	10584	2851	2910	2851
query25	591	410	381	381
query26	700	150	146	146
query27	2384	277	281	277
query28	6187	2071	2030	2030
query29	892	643	632	632
query30	260	152	150	150
query31	976	739	782	739
query32	96	52	55	52
query33	657	333	337	333
query34	958	494	514	494
query35	848	764	752	752
query36	1155	963	963	963
query37	131	79	77	77
query38	2865	2769	2716	2716
query39	888	834	804	804
query40	195	117	116	116
query41	46	43	45	43
query42	131	97	100	97
query43	502	454	476	454
query44	1090	728	745	728
query45	194	188	157	157
query46	1090	732	740	732
query47	1893	1772	1769	1769
query48	356	288	295	288
query49	827	398	405	398
query50	779	403	391	391
query51	6886	6925	6758	6758
query52	106	89	89	89
query53	349	280	294	280
query54	882	440	449	440
query55	73	73	73	73
query56	279	266	292	266
query57	1121	1080	1025	1025
query58	235	239	249	239
query59	2784	2559	2540	2540
query60	297	277	272	272
query61	97	93	91	91
query62	764	631	663	631
query63	321	279	281	279
query64	9151	2212	1613	1613
query65	3137	3073	3062	3062
query66	753	322	332	322
query67	15526	15092	14956	14956
query68	4519	552	541	541
query69	549	377	339	339
query70	1190	1137	1126	1126
query71	370	276	278	276
query72	7408	5790	5379	5379
query73	738	317	317	317
query74	6274	5639	5667	5639
query75	3369	2642	2666	2642
query76	2186	914	848	848
query77	436	319	297	297
query78	9692	9163	8929	8929
query79	3070	519	525	519
query80	2009	518	457	457
query81	577	217	216	216
query82	959	131	136	131
query83	320	165	164	164
query84	277	90	84	84
query85	1744	316	287	287
query86	482	312	311	311
query87	3351	3131	3085	3085
query88	4434	2368	2351	2351
query89	490	384	389	384
query90	1824	194	187	187
query91	125	98	99	98
query92	63	48	48	48
query93	5300	508	517	508
query94	1258	283	272	272
query95	389	315	323	315
query96	596	273	265	265
query97	3185	3072	3022	3022
query98	224	198	206	198
query99	1559	1294	1264	1264
Total cold run time: 279020 ms
Total hot run time: 173341 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.22	0.06	0.06
query4	1.67	0.08	0.07
query5	0.50	0.49	0.48
query6	1.13	0.72	0.74
query7	0.02	0.02	0.01
query8	0.04	0.04	0.04
query9	0.54	0.49	0.48
query10	0.53	0.54	0.54
query11	0.15	0.12	0.11
query12	0.15	0.12	0.12
query13	0.61	0.59	0.57
query14	0.76	0.77	0.77
query15	0.84	0.80	0.81
query16	0.38	0.37	0.37
query17	0.96	1.04	0.96
query18	0.23	0.21	0.21
query19	1.80	1.86	1.78
query20	0.02	0.01	0.01
query21	15.40	0.79	0.65
query22	3.79	6.81	1.90
query23	18.28	1.46	1.21
query24	2.17	0.23	0.22
query25	0.16	0.09	0.08
query26	0.30	0.21	0.20
query27	0.46	0.23	0.23
query28	13.21	1.01	1.01
query29	12.68	3.25	3.27
query30	0.25	0.07	0.06
query31	2.88	0.38	0.38
query32	3.26	0.49	0.48
query33	2.87	2.99	2.87
query34	17.05	4.36	4.35
query35	4.39	4.40	4.41
query36	0.65	0.49	0.46
query37	0.19	0.16	0.16
query38	0.16	0.14	0.15
query39	0.05	0.04	0.03
query40	0.15	0.13	0.13
query41	0.09	0.05	0.05
query42	0.06	0.04	0.05
query43	0.05	0.04	0.04
Total cold run time: 109.22 s
Total hot run time: 30.51 s

@feiniaofeiafei
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17620	4327	4288	4288
q2	2017	186	189	186
q3	10473	1187	1104	1104
q4	10183	838	740	740
q5	7554	2678	2690	2678
q6	222	135	136	135
q7	950	615	609	609
q8	9226	2078	2036	2036
q9	8805	6527	6506	6506
q10	8843	3816	3795	3795
q11	446	241	234	234
q12	445	233	225	225
q13	17769	2973	3012	2973
q14	275	234	236	234
q15	521	475	470	470
q16	491	404	378	378
q17	944	660	688	660
q18	8096	7552	7386	7386
q19	7819	1256	1227	1227
q20	685	338	333	333
q21	4868	3190	3198	3190
q22	350	290	287	287
Total cold run time: 118602 ms
Total hot run time: 39674 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4390	4209	4246	4209
q2	368	273	267	267
q3	2985	2948	2927	2927
q4	2000	1719	1747	1719
q5	5553	5514	5499	5499
q6	223	136	141	136
q7	2219	1863	1869	1863
q8	3249	3433	3398	3398
q9	8718	8840	8852	8840
q10	4043	3819	3815	3815
q11	599	501	512	501
q12	794	644	645	644
q13	15894	3141	3216	3141
q14	312	283	301	283
q15	525	489	490	489
q16	496	447	445	445
q17	1815	1556	1509	1509
q18	7979	7861	7805	7805
q19	1713	1530	1652	1530
q20	2193	1859	1883	1859
q21	4997	4978	4735	4735
q22	603	495	482	482
Total cold run time: 71668 ms
Total hot run time: 56096 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 174194 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 ad9968523f6fd69cb190a79fc0023bcb1ea7c71b, data reload: false

query1	920	366	368	366
query2	6441	1921	1874	1874
query3	6654	208	215	208
query4	28490	17528	17579	17528
query5	3641	474	477	474
query6	270	169	160	160
query7	4578	291	279	279
query8	247	188	184	184
query9	8600	2472	2458	2458
query10	449	285	274	274
query11	10535	10087	10030	10030
query12	118	95	83	83
query13	1642	379	373	373
query14	10274	8324	7852	7852
query15	228	169	168	168
query16	7522	500	460	460
query17	1608	568	544	544
query18	1690	285	288	285
query19	204	161	157	157
query20	91	83	80	80
query21	203	134	132	132
query22	4346	4199	3982	3982
query23	34038	33827	33542	33542
query24	10664	2900	2926	2900
query25	614	422	412	412
query26	717	157	158	157
query27	2243	288	282	282
query28	5907	2127	2098	2098
query29	911	726	625	625
query30	253	157	154	154
query31	1009	791	757	757
query32	92	53	54	53
query33	656	352	331	331
query34	900	480	503	480
query35	881	777	761	761
query36	1144	966	965	965
query37	146	80	86	80
query38	2940	2809	2787	2787
query39	905	823	800	800
query40	195	120	117	117
query41	43	47	43	43
query42	121	100	102	100
query43	516	482	456	456
query44	1103	733	732	732
query45	192	161	162	161
query46	1081	759	739	739
query47	1824	1768	1733	1733
query48	360	300	291	291
query49	834	403	399	399
query50	792	391	388	388
query51	6768	6599	6815	6599
query52	108	91	96	91
query53	355	285	312	285
query54	876	451	443	443
query55	77	73	72	72
query56	283	263	256	256
query57	1104	1048	1072	1048
query58	259	249	252	249
query59	2893	2808	2672	2672
query60	296	268	266	266
query61	96	90	98	90
query62	811	636	643	636
query63	315	288	286	286
query64	9191	2215	1636	1636
query65	3155	3099	3105	3099
query66	745	327	328	327
query67	15455	14977	15014	14977
query68	4582	544	543	543
query69	565	362	339	339
query70	1177	1145	1156	1145
query71	429	278	282	278
query72	8176	5609	5519	5519
query73	744	323	331	323
query74	6120	5665	5609	5609
query75	3834	2678	2682	2678
query76	2666	989	869	869
query77	629	310	305	305
query78	10382	9060	9025	9025
query79	3360	533	522	522
query80	2669	471	470	470
query81	600	223	224	223
query82	1348	136	136	136
query83	316	166	166	166
query84	326	88	88	88
query85	1521	309	287	287
query86	484	312	326	312
query87	3352	3129	3112	3112
query88	4697	2375	2380	2375
query89	501	397	376	376
query90	1993	191	189	189
query91	127	101	100	100
query92	63	52	53	52
query93	4162	509	500	500
query94	1396	290	281	281
query95	414	312	315	312
query96	609	272	273	272
query97	3227	3107	3029	3029
query98	229	209	193	193
query99	1637	1240	1278	1240
Total cold run time: 284954 ms
Total hot run time: 174194 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.09	0.05	0.04
query3	0.22	0.04	0.04
query4	1.69	0.07	0.07
query5	0.50	0.50	0.49
query6	1.15	0.73	0.71
query7	0.02	0.01	0.02
query8	0.05	0.05	0.04
query9	0.54	0.50	0.48
query10	0.54	0.54	0.55
query11	0.16	0.12	0.12
query12	0.14	0.11	0.12
query13	0.59	0.58	0.59
query14	0.77	0.78	0.78
query15	0.87	0.81	0.81
query16	0.36	0.37	0.36
query17	1.02	1.04	1.02
query18	0.22	0.21	0.21
query19	1.85	1.82	1.84
query20	0.01	0.01	0.01
query21	15.41	0.77	0.64
query22	4.36	7.82	1.94
query23	18.27	1.42	1.21
query24	2.13	0.21	0.22
query25	0.16	0.09	0.08
query26	0.30	0.21	0.21
query27	0.45	0.23	0.22
query28	13.36	1.02	1.00
query29	12.64	3.27	3.27
query30	0.25	0.06	0.05
query31	2.86	0.39	0.39
query32	3.26	0.47	0.47
query33	2.87	2.91	2.90
query34	17.12	4.30	4.34
query35	4.37	4.38	4.37
query36	0.65	0.46	0.46
query37	0.18	0.16	0.15
query38	0.15	0.15	0.15
query39	0.05	0.04	0.04
query40	0.14	0.12	0.12
query41	0.09	0.04	0.05
query42	0.05	0.04	0.04
query43	0.05	0.05	0.04
Total cold run time: 110.01 s
Total hot run time: 30.58 s

@feiniaofeiafei
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17626	4445	4321	4321
q2	2015	191	187	187
q3	10452	1215	1060	1060
q4	10183	886	746	746
q5	7535	2734	2661	2661
q6	222	137	142	137
q7	954	597	602	597
q8	9232	2086	2088	2086
q9	8795	6586	6587	6586
q10	8879	3818	3787	3787
q11	451	233	232	232
q12	443	222	220	220
q13	17768	2974	2951	2951
q14	280	237	239	237
q15	539	494	490	490
q16	511	378	378	378
q17	970	701	733	701
q18	8121	7462	7313	7313
q19	8485	1418	1357	1357
q20	681	327	318	318
q21	4914	3346	3255	3255
q22	347	279	298	279
Total cold run time: 119403 ms
Total hot run time: 39899 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4374	4279	4273	4273
q2	369	264	261	261
q3	3122	2952	2920	2920
q4	1972	1706	1691	1691
q5	5619	5512	5489	5489
q6	225	143	130	130
q7	2276	1829	1869	1829
q8	3278	3466	3456	3456
q9	8791	8935	8789	8789
q10	4186	3797	3866	3797
q11	604	506	505	505
q12	844	643	630	630
q13	16251	3168	3174	3168
q14	314	291	306	291
q15	518	501	490	490
q16	485	425	451	425
q17	1812	1551	1505	1505
q18	8156	8001	7918	7918
q19	3496	1683	1588	1588
q20	2198	1891	1835	1835
q21	5302	4863	4811	4811
q22	607	519	538	519
Total cold run time: 74799 ms
Total hot run time: 56320 ms

@morrySnow
Copy link
Contributor

add desc

@doris-robot
Copy link

TPC-DS: Total hot run time: 173083 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 6987b73c20d7ef9a9ba596341a55b1c31334087c, data reload: false

query1	915	379	376	376
query2	6437	1898	1852	1852
query3	6660	205	220	205
query4	27225	17486	17232	17232
query5	3667	471	485	471
query6	261	183	162	162
query7	4579	300	283	283
query8	242	203	190	190
query9	8485	2474	2442	2442
query10	437	288	275	275
query11	11298	9971	10029	9971
query12	116	89	91	89
query13	1636	369	383	369
query14	10336	7275	7737	7275
query15	224	172	173	172
query16	7757	476	448	448
query17	1577	562	539	539
query18	1773	284	287	284
query19	203	157	161	157
query20	89	84	84	84
query21	210	131	128	128
query22	4309	4184	3924	3924
query23	34154	33866	33601	33601
query24	11021	2946	2898	2898
query25	632	407	414	407
query26	1158	155	214	155
query27	2420	272	275	272
query28	7162	2088	2091	2088
query29	881	655	644	644
query30	263	161	157	157
query31	979	786	760	760
query32	98	53	60	53
query33	750	332	345	332
query34	960	469	477	469
query35	856	766	758	758
query36	1159	1000	956	956
query37	153	84	80	80
query38	2932	2873	2763	2763
query39	939	857	833	833
query40	205	117	117	117
query41	46	42	43	42
query42	116	97	97	97
query43	503	465	457	457
query44	1188	728	724	724
query45	200	166	160	160
query46	1089	733	732	732
query47	1863	1737	1756	1737
query48	362	282	290	282
query49	854	407	407	407
query50	777	387	382	382
query51	6703	6682	6725	6682
query52	111	96	91	91
query53	359	287	297	287
query54	895	457	435	435
query55	73	71	72	71
query56	286	276	275	275
query57	1123	1031	1024	1024
query58	249	247	253	247
query59	2790	2678	2582	2582
query60	289	266	267	266
query61	99	96	97	96
query62	800	628	629	628
query63	319	286	290	286
query64	9456	2232	1670	1670
query65	3189	3066	3098	3066
query66	707	336	333	333
query67	15463	14886	15163	14886
query68	4551	547	543	543
query69	600	388	357	357
query70	1236	1174	1063	1063
query71	459	273	316	273
query72	8607	5525	5874	5525
query73	762	318	319	318
query74	6112	5677	5647	5647
query75	3705	2740	2679	2679
query76	3201	907	885	885
query77	679	315	311	311
query78	13004	9534	9019	9019
query79	8345	528	521	521
query80	1298	472	474	472
query81	598	217	226	217
query82	547	137	134	134
query83	338	168	167	167
query84	274	86	88	86
query85	769	295	299	295
query86	452	310	302	302
query87	3360	3118	3082	3082
query88	5220	2371	2395	2371
query89	545	378	384	378
query90	2087	195	194	194
query91	130	98	100	98
query92	59	52	52	52
query93	4587	502	507	502
query94	1287	294	289	289
query95	403	314	316	314
query96	630	276	275	275
query97	3237	3039	3062	3039
query98	231	205	202	202
query99	1539	1257	1265	1257
Total cold run time: 293919 ms
Total hot run time: 173083 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.09	0.04	0.04
query3	0.23	0.06	0.06
query4	1.67	0.09	0.09
query5	0.52	0.50	0.49
query6	1.14	0.73	0.74
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.55	0.51	0.49
query10	0.53	0.53	0.55
query11	0.15	0.11	0.12
query12	0.14	0.12	0.12
query13	0.60	0.59	0.59
query14	0.75	0.78	0.79
query15	0.87	0.81	0.82
query16	0.36	0.37	0.37
query17	0.98	1.02	0.97
query18	0.23	0.22	0.22
query19	1.81	1.73	1.74
query20	0.01	0.00	0.00
query21	15.42	0.78	0.66
query22	3.64	8.41	1.90
query23	18.33	1.42	1.25
query24	2.10	0.24	0.22
query25	0.16	0.08	0.09
query26	0.33	0.24	0.25
query27	0.46	0.26	0.27
query28	13.27	1.02	0.99
query29	12.58	3.45	3.41
query30	0.25	0.06	0.05
query31	2.86	0.42	0.41
query32	3.22	0.48	0.47
query33	2.87	2.92	2.91
query34	17.06	4.32	4.31
query35	4.40	4.37	4.39
query36	0.65	0.47	0.48
query37	0.19	0.16	0.15
query38	0.16	0.15	0.15
query39	0.04	0.04	0.04
query40	0.15	0.13	0.13
query41	0.10	0.05	0.05
query42	0.06	0.05	0.05
query43	0.05	0.04	0.04
Total cold run time: 109.09 s
Total hot run time: 30.82 s

@feiniaofeiafei
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17614	4399	4290	4290
q2	2019	187	189	187
q3	10438	1224	1081	1081
q4	10195	846	717	717
q5	7525	2708	2652	2652
q6	221	137	138	137
q7	959	603	615	603
q8	9215	2049	2072	2049
q9	9014	6588	6533	6533
q10	8812	3821	3752	3752
q11	458	244	243	243
q12	460	222	226	222
q13	17757	3003	2963	2963
q14	289	231	227	227
q15	537	479	494	479
q16	496	375	380	375
q17	955	708	659	659
q18	8094	7566	7381	7381
q19	3973	1274	1372	1274
q20	688	327	343	327
q21	4919	3202	3281	3202
q22	344	284	286	284
Total cold run time: 114982 ms
Total hot run time: 39637 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4393	4209	4200	4200
q2	365	257	268	257
q3	3014	2763	2852	2763
q4	1981	1780	1687	1687
q5	5608	5566	5532	5532
q6	219	141	134	134
q7	2257	1795	1880	1795
q8	3327	3448	3404	3404
q9	8742	8730	8853	8730
q10	4093	3883	3822	3822
q11	585	488	484	484
q12	774	639	659	639
q13	17088	3187	3175	3175
q14	324	277	303	277
q15	549	496	499	496
q16	501	425	427	425
q17	1888	1552	1509	1509
q18	8080	8070	7769	7769
q19	2603	1699	1648	1648
q20	2296	1926	1872	1872
q21	9496	4886	4888	4886
q22	594	507	541	507
Total cold run time: 78777 ms
Total hot run time: 56011 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 174428 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 025a6631e3539cff5a6100dda9127b1cdf2b4f6b, data reload: false

query1	925	379	363	363
query2	6463	1891	1829	1829
query3	6635	210	213	210
query4	28505	17432	17373	17373
query5	3686	491	470	470
query6	259	174	163	163
query7	4598	294	300	294
query8	248	189	186	186
query9	8797	2482	2427	2427
query10	429	277	278	277
query11	10458	10091	9979	9979
query12	116	83	89	83
query13	1655	378	379	378
query14	10234	7868	7682	7682
query15	233	167	172	167
query16	7644	465	456	456
query17	1608	579	545	545
query18	1934	286	288	286
query19	204	154	156	154
query20	90	83	81	81
query21	206	126	123	123
query22	4418	4377	3990	3990
query23	34103	33750	33686	33686
query24	11078	2954	2871	2871
query25	621	401	419	401
query26	708	160	157	157
query27	2223	280	288	280
query28	5949	2184	2093	2093
query29	906	623	649	623
query30	255	148	152	148
query31	971	800	763	763
query32	104	55	56	55
query33	747	339	331	331
query34	933	499	495	495
query35	866	789	759	759
query36	1156	992	1009	992
query37	134	109	82	82
query38	2916	2857	2805	2805
query39	917	867	847	847
query40	206	121	126	121
query41	48	43	44	43
query42	115	105	100	100
query43	520	475	465	465
query44	1180	752	741	741
query45	194	166	159	159
query46	1094	714	711	711
query47	1832	1788	1781	1781
query48	358	299	302	299
query49	826	411	419	411
query50	776	395	388	388
query51	6813	6740	6638	6638
query52	106	93	90	90
query53	354	302	284	284
query54	887	451	442	442
query55	75	76	73	73
query56	299	268	264	264
query57	1115	1083	1090	1083
query58	254	251	250	250
query59	2717	2628	2586	2586
query60	296	276	274	274
query61	119	92	94	92
query62	816	641	663	641
query63	320	288	288	288
query64	9119	2230	1658	1658
query65	3151	3122	3093	3093
query66	760	323	334	323
query67	15506	15102	15079	15079
query68	4604	549	560	549
query69	690	408	351	351
query70	1184	1087	1133	1087
query71	432	278	276	276
query72	8673	5699	5707	5699
query73	752	323	324	323
query74	6107	5628	5666	5628
query75	4305	2722	2646	2646
query76	3069	955	920	920
query77	707	305	300	300
query78	9899	9100	9867	9100
query79	1765	536	524	524
query80	2421	471	479	471
query81	598	219	223	219
query82	742	138	134	134
query83	306	165	171	165
query84	261	91	85	85
query85	1648	311	322	311
query86	478	307	310	307
query87	3283	3207	3104	3104
query88	4207	2355	2372	2355
query89	481	388	387	387
query90	2033	193	194	193
query91	128	98	100	98
query92	64	48	48	48
query93	1777	503	500	500
query94	1430	287	296	287
query95	406	311	318	311
query96	586	267	274	267
query97	3189	3058	3050	3050
query98	216	194	197	194
query99	1546	1271	1258	1258
Total cold run time: 281775 ms
Total hot run time: 174428 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.04
query2	0.09	0.04	0.03
query3	0.22	0.05	0.05
query4	1.68	0.08	0.08
query5	0.51	0.47	0.49
query6	1.12	0.72	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.05
query9	0.55	0.50	0.49
query10	0.54	0.54	0.55
query11	0.15	0.11	0.12
query12	0.15	0.12	0.12
query13	0.61	0.58	0.59
query14	0.77	0.77	0.77
query15	0.85	0.81	0.80
query16	0.35	0.37	0.35
query17	0.96	0.98	0.98
query18	0.22	0.22	0.21
query19	1.82	1.78	1.71
query20	0.01	0.02	0.02
query21	15.44	0.77	0.65
query22	3.51	7.55	2.28
query23	18.31	1.37	1.26
query24	2.20	0.22	0.22
query25	0.16	0.09	0.08
query26	0.28	0.21	0.20
query27	0.45	0.23	0.23
query28	13.20	1.01	1.00
query29	12.61	3.34	3.32
query30	0.25	0.06	0.05
query31	2.87	0.38	0.38
query32	3.29	0.48	0.47
query33	2.86	2.94	2.87
query34	17.08	4.46	4.37
query35	4.37	4.42	4.45
query36	0.66	0.47	0.48
query37	0.18	0.15	0.16
query38	0.15	0.16	0.14
query39	0.05	0.03	0.04
query40	0.15	0.12	0.12
query41	0.09	0.06	0.05
query42	0.06	0.05	0.04
query43	0.04	0.04	0.04
Total cold run time: 108.97 s
Total hot run time: 30.95 s

@morrySnow morrySnow added not-merge/2.0 do not merge into 2.0 branch and removed dev/2.0.x labels Jul 22, 2024
@feiniaofeiafei
Copy link
Contributor Author

run cloud_p0

@feiniaofeiafei
Copy link
Contributor Author

run cloud_p1

morrySnow
morrySnow previously approved these changes Jul 23, 2024
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jul 23, 2024
"""

qt_alias "select id as c1 from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1;"
qt_alias_grouping_scalar "select id as c1, grouping(id) from grouping_alias_test_t group by grouping sets((id,value2),(id)) order by 1,2;"
Copy link
Contributor

Choose a reason for hiding this comment

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

we can add more test case like bellow:
select id as c1, id, id as c3, grouping(id) from table1 group by grouping sets((c1, value2),(c3));
the alias in grouping sets

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Jul 23, 2024
@feiniaofeiafei
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17611	4332	4297	4297
q2	2009	189	195	189
q3	10453	1170	1106	1106
q4	10186	788	914	788
q5	7530	2702	2635	2635
q6	221	141	139	139
q7	950	604	607	604
q8	9225	2052	2066	2052
q9	8747	6534	6543	6534
q10	8828	3831	3810	3810
q11	459	239	242	239
q12	416	221	229	221
q13	17783	3017	2992	2992
q14	277	236	247	236
q15	516	479	495	479
q16	494	391	383	383
q17	964	691	718	691
q18	8056	7521	7447	7447
q19	7475	1464	1392	1392
q20	678	334	326	326
q21	4935	3133	3247	3133
q22	369	294	288	288
Total cold run time: 118182 ms
Total hot run time: 39981 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4363	4234	4227	4227
q2	364	265	261	261
q3	3007	2953	2899	2899
q4	2027	1666	1700	1666
q5	5607	5538	5528	5528
q6	238	134	137	134
q7	2216	1879	1883	1879
q8	3297	3390	3418	3390
q9	8820	8817	8893	8817
q10	4108	3929	3785	3785
q11	590	518	489	489
q12	797	642	633	633
q13	16341	3230	3173	3173
q14	337	299	306	299
q15	526	487	478	478
q16	489	455	447	447
q17	1816	1509	1526	1509
q18	8178	7811	7876	7811
q19	1744	1575	1468	1468
q20	2183	1892	1892	1892
q21	7437	5089	4691	4691
q22	610	526	506	506
Total cold run time: 75095 ms
Total hot run time: 55982 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 175108 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 1487abfdbe77d4f7fe5ab308c15420acd4657db2, data reload: false

query1	919	382	373	373
query2	6448	1908	1809	1809
query3	6630	208	220	208
query4	28727	17507	17373	17373
query5	3646	487	482	482
query6	283	177	153	153
query7	4579	291	290	290
query8	240	195	199	195
query9	8688	2451	2399	2399
query10	431	295	289	289
query11	10634	10168	10099	10099
query12	118	87	86	86
query13	1667	375	361	361
query14	10176	7732	7774	7732
query15	226	173	163	163
query16	7821	473	525	473
query17	1588	555	528	528
query18	2027	273	273	273
query19	189	147	148	147
query20	89	82	80	80
query21	212	130	124	124
query22	4256	4009	4247	4009
query23	34254	33759	34482	33759
query24	10814	2903	2985	2903
query25	588	421	376	376
query26	688	172	151	151
query27	2111	280	287	280
query28	6225	2136	2130	2130
query29	913	648	654	648
query30	248	151	152	151
query31	972	766	744	744
query32	97	56	56	56
query33	688	330	336	330
query34	911	476	501	476
query35	881	783	785	783
query36	1200	979	993	979
query37	140	79	80	79
query38	2956	2856	2838	2838
query39	927	884	835	835
query40	210	117	119	117
query41	47	43	43	43
query42	121	95	101	95
query43	505	471	453	453
query44	1155	748	732	732
query45	195	169	161	161
query46	1115	759	740	740
query47	1872	1811	1764	1764
query48	361	302	295	295
query49	821	411	413	411
query50	781	399	395	395
query51	6857	6633	6772	6633
query52	106	93	100	93
query53	357	296	290	290
query54	881	450	448	448
query55	74	74	76	74
query56	288	303	275	275
query57	1113	1030	1068	1030
query58	254	256	253	253
query59	2941	2615	2566	2566
query60	295	294	302	294
query61	93	93	95	93
query62	796	664	644	644
query63	326	284	283	283
query64	9185	2234	1761	1761
query65	3169	3128	3128	3128
query66	746	330	341	330
query67	15657	15046	15014	15014
query68	4515	547	550	547
query69	530	345	339	339
query70	1213	1127	1016	1016
query71	396	290	284	284
query72	7876	5786	5835	5786
query73	755	329	330	329
query74	6046	5665	5695	5665
query75	3501	2715	2723	2715
query76	2615	989	958	958
query77	642	334	311	311
query78	12301	9329	9139	9139
query79	2903	534	519	519
query80	1178	502	484	484
query81	583	220	222	220
query82	576	137	137	137
query83	345	173	167	167
query84	277	88	87	87
query85	737	330	313	313
query86	429	333	345	333
query87	3315	3163	3177	3163
query88	4444	2392	2441	2392
query89	487	376	380	376
query90	1962	203	202	202
query91	135	106	108	106
query92	61	51	50	50
query93	3799	520	516	516
query94	1088	298	296	296
query95	401	329	334	329
query96	628	275	277	275
query97	3215	3051	3027	3027
query98	222	200	195	195
query99	1507	1280	1253	1253
Total cold run time: 283210 ms
Total hot run time: 175108 ms

@doris-robot
Copy link

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

query1	0.05	0.03	0.03
query2	0.08	0.04	0.03
query3	0.22	0.05	0.04
query4	1.68	0.08	0.08
query5	0.49	0.50	0.49
query6	1.12	0.72	0.72
query7	0.02	0.01	0.01
query8	0.05	0.05	0.04
query9	0.55	0.50	0.48
query10	0.55	0.56	0.55
query11	0.16	0.12	0.12
query12	0.15	0.12	0.12
query13	0.60	0.59	0.58
query14	0.76	0.78	0.78
query15	0.85	0.82	0.82
query16	0.37	0.37	0.35
query17	1.02	0.98	1.00
query18	0.23	0.22	0.22
query19	1.77	1.75	1.74
query20	0.01	0.01	0.01
query21	15.39	0.77	0.65
query22	3.85	6.97	2.01
query23	18.34	1.34	1.30
query24	2.12	0.23	0.23
query25	0.16	0.08	0.09
query26	0.30	0.22	0.21
query27	0.46	0.23	0.23
query28	13.26	1.03	1.01
query29	12.62	3.32	3.28
query30	0.25	0.06	0.06
query31	2.87	0.38	0.39
query32	3.28	0.48	0.47
query33	2.90	2.91	2.88
query34	17.04	4.42	4.40
query35	4.42	4.44	4.45
query36	0.66	0.46	0.49
query37	0.19	0.17	0.15
query38	0.15	0.14	0.14
query39	0.04	0.04	0.03
query40	0.15	0.13	0.12
query41	0.10	0.06	0.05
query42	0.05	0.05	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.37 s
Total hot run time: 30.86 s

@feiniaofeiafei
Copy link
Contributor Author

run p0

@feiniaofeiafei
Copy link
Contributor Author

run external

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jul 24, 2024
Copy link
Contributor

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

@feiniaofeiafei
Copy link
Contributor Author

run p0

1 similar comment
@feiniaofeiafei
Copy link
Contributor Author

run p0

@morrySnow morrySnow merged commit 7090433 into apache:master Jul 26, 2024
28 of 30 checks passed
feiniaofeiafei added a commit to feiniaofeiafei/doris that referenced this pull request Jul 29, 2024
Induced by apache#34196.

In NormalizeRepeat, when NormalizeToSlot is called, aggregate function
parameters, grouping scalar function parameters, and all expressions in
grouping sets (including columns and column aliases) are pushed down to
the lower-level project output.
In the previous PR apache#34196, the context was split into two, but the two
contexts were not consistent. It is possible that the triplets in one
context save (id, c1, id as c1), and the triplets in the other context
save (id, id, id).
This causes id as c1 to be pushed down, but there is a reference to id
in the upper-level LogicalRepeat, which causes the slot to be not found.
This pr has been modified.
If the same slot in the projection column has different aliases,

for example,

select id as c1, id, id as c3, grouping(id) from table1 group by grouping sets((id, value2),(id));

then id as c1 (using the first alias) will be pushed down to the
project.
In both the LogicalRepeat operator and the LogicalAggregate operator, c1
is referenced as the input slot, and id and c3 will not be used as input
slots.

before NormalizeRepeat:
LogicalResultSink[32] ( outputExprs=[c1#3, id#0, c3#4, __grouping_3#5] )
+--LogicalRepeat ( groupingSets=[[id#0, value2#2], [id#0]], outputExpressions=[id#0 AS `c1`apache#3, id#0, id#0 AS `c3`apache#4, Grouping(id#0) AS `Grouping(id)`apache#5] )
   +--LogicalOlapScan (qualified=table1)

After NormalizeRepeat:
LogicalResultSink[33] (outputExprs=[c1#3, id#0, c3#4, __grouping_3#5])
+--LogicalAggregate[30] (groupByExpr=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)], outputExpr=[c1#3, c1#3 AS `id`#0, c1#3 AS `c3`apache#4, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3) AS `GROUPING_PREFIX_c1`apache#5], hasRepeat=true )
   +--LogicalRepeat (groupingSets=[[c1#3, value2#2], [c1#3]], outputExpressions=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)] )
      +--LogicalProject[28] (projects=[id#0 AS `c1`apache#3, value2#2])
         +--LogicalOlapScan (qualified=table1)
feiniaofeiafei added a commit to feiniaofeiafei/doris that referenced this pull request Jul 30, 2024
Induced by apache#34196.

In NormalizeRepeat, when NormalizeToSlot is called, aggregate function
parameters, grouping scalar function parameters, and all expressions in
grouping sets (including columns and column aliases) are pushed down to
the lower-level project output.
In the previous PR apache#34196, the context was split into two, but the two
contexts were not consistent. It is possible that the triplets in one
context save (id, c1, id as c1), and the triplets in the other context
save (id, id, id).
This causes id as c1 to be pushed down, but there is a reference to id
in the upper-level LogicalRepeat, which causes the slot to be not found.
This pr has been modified.
If the same slot in the projection column has different aliases,

for example,

select id as c1, id, id as c3, grouping(id) from table1 group by grouping sets((id, value2),(id));

then id as c1 (using the first alias) will be pushed down to the
project.
In both the LogicalRepeat operator and the LogicalAggregate operator, c1
is referenced as the input slot, and id and c3 will not be used as input
slots.

before NormalizeRepeat:
LogicalResultSink[32] ( outputExprs=[c1#3, id#0, c3#4, __grouping_3#5] )
+--LogicalRepeat ( groupingSets=[[id#0, value2#2], [id#0]], outputExpressions=[id#0 AS `c1`apache#3, id#0, id#0 AS `c3`apache#4, Grouping(id#0) AS `Grouping(id)`apache#5] )
   +--LogicalOlapScan (qualified=table1)

After NormalizeRepeat:
LogicalResultSink[33] (outputExprs=[c1#3, id#0, c3#4, __grouping_3#5])
+--LogicalAggregate[30] (groupByExpr=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)], outputExpr=[c1#3, c1#3 AS `id`#0, c1#3 AS `c3`apache#4, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3) AS `GROUPING_PREFIX_c1`apache#5], hasRepeat=true )
   +--LogicalRepeat (groupingSets=[[c1#3, value2#2], [c1#3]], outputExpressions=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)] )
      +--LogicalProject[28] (projects=[id#0 AS `c1`apache#3, value2#2])
         +--LogicalOlapScan (qualified=table1)
yiguolei pushed a commit that referenced this pull request Jul 31, 2024
dataroaring pushed a commit that referenced this pull request Aug 2, 2024
Induced by #34196.

In NormalizeRepeat, when NormalizeToSlot is called, aggregate function
parameters, grouping scalar function parameters, and all expressions in
grouping sets (including columns and column aliases) are pushed down to
the lower-level project output.
In the previous PR #34196, the context was split into two, but the two
contexts were not consistent. It is possible that the triplets in one
context save (id, c1, id as c1), and the triplets in the other context
save (id, id, id).
This causes id as c1 to be pushed down, but there is a reference to id
in the upper-level LogicalRepeat, which causes the slot to be not found.
This pr has been modified.
If the same slot in the projection column has different aliases,

for example,

select id as c1, id, id as c3, grouping(id) from table1 group by grouping sets((id, value2),(id));

then id as c1 (using the first alias) will be pushed down to the
project.
In both the LogicalRepeat operator and the LogicalAggregate operator, c1
is referenced as the input slot, and id and c3 will not be used as input
slots.

before NormalizeRepeat:
LogicalResultSink[32] ( outputExprs=[c1#3, id#0, c3#4, __grouping_3#5] )
+--LogicalRepeat ( groupingSets=[[id#0, value2#2], [id#0]], outputExpressions=[id#0 AS `c1`#3, id#0, id#0 AS `c3`#4, Grouping(id#0) AS `Grouping(id)`#5] )
   +--LogicalOlapScan (qualified=table1)

After NormalizeRepeat:
LogicalResultSink[33] (outputExprs=[c1#3, id#0, c3#4, __grouping_3#5])
+--LogicalAggregate[30] (groupByExpr=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)], outputExpr=[c1#3, c1#3 AS `id`#0, c1#3 AS `c3`#4, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3) AS `GROUPING_PREFIX_c1`#5], hasRepeat=true )
   +--LogicalRepeat (groupingSets=[[c1#3, value2#2], [c1#3]], outputExpressions=[c1#3, value2#2, GROUPING_ID#7, GROUPING_PREFIX_c1#6 originExpression=Grouping(c1#3)] )
      +--LogicalProject[28] (projects=[id#0 AS `c1`#3, value2#2])
         +--LogicalOlapScan (qualified=table1)
@yiguolei yiguolei mentioned this pull request Sep 5, 2024
3 tasks
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.6-merged dev/3.0.1-merged not-merge/2.0 do not merge into 2.0 branch p0_b reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants