Skip to content

[fix](nereids)EliminateGroupByKeyByUniform should replace exprId for alias#60020

Merged
englefly merged 1 commit intoapache:masterfrom
englefly:ExprIdRewriterTest
Feb 6, 2026
Merged

[fix](nereids)EliminateGroupByKeyByUniform should replace exprId for alias#60020
englefly merged 1 commit intoapache:masterfrom
englefly:ExprIdRewriterTest

Conversation

@englefly
Copy link
Contributor

@englefly englefly commented Jan 19, 2026

What problem does this PR solve?

Input plan has:

Sink(output #8)
+->LogicalProject[projects=[200 AS `field1`#8, field2#9]]
    +-->Aggregate(gropuBy=[field1#8, field2], output=[field1#8, ...] ...)
               +->Project(a#7 as field1, ...)
                         +->Filter(a=2)
                                 +->Scan(T)

a has unique value, so it could be removed from groupBy
the output plan is

Sink(output #10)
+->LogicalProject[projects=[200 AS `field1`#8, field2#9]]
    +-->Aggregate(gropuBy=[field2],  output=[any_value(field1#8) as #10, ...])
               +->Project(a#7 as field1, ...)
                         +->Filter(a=2)
                                 +->Scan(T)

if 200 AS field1#8 is not rewritten by EliminateGroupByKeyByUniform, planner cannot find the input slot #10 for Sink from its child.

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

@Thearas
Copy link
Contributor

Thearas commented Jan 19, 2026

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?

@englefly
Copy link
Contributor Author

run buildall

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

starocean999
starocean999 previously approved these changes Jan 20, 2026
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jan 20, 2026
@github-actions
Copy link
Contributor

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

@englefly
Copy link
Contributor Author

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Jan 20, 2026
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17670	4205	4064	4064
q2	2000	382	230	230
q3	10151	1290	715	715
q4	10211	838	309	309
q5	7492	2065	1851	1851
q6	190	173	133	133
q7	906	756	642	642
q8	9265	1303	1138	1138
q9	4865	4604	4521	4521
q10	6788	1811	1400	1400
q11	527	293	275	275
q12	684	735	594	594
q13	17756	3798	3055	3055
q14	294	291	281	281
q15	563	532	502	502
q16	730	668	627	627
q17	639	853	416	416
q18	7312	6690	7209	6690
q19	1109	1062	692	692
q20	426	391	252	252
q21	3272	2699	2669	2669
q22	1178	1150	1086	1086
Total cold run time: 104028 ms
Total hot run time: 32142 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4522	4400	4325	4325
q2	323	413	323	323
q3	2221	2752	2419	2419
q4	1483	1842	1683	1683
q5	4480	4290	4414	4290
q6	206	168	128	128
q7	1900	1927	1808	1808
q8	2569	2595	2395	2395
q9	7211	7248	7157	7157
q10	2507	2748	2278	2278
q11	573	503	441	441
q12	680	784	635	635
q13	3668	4015	3111	3111
q14	273	287	271	271
q15	524	489	479	479
q16	604	644	595	595
q17	1070	1295	1285	1285
q18	7375	7350	7497	7350
q19	842	767	771	767
q20	1876	1962	1799	1799
q21	4517	4209	4157	4157
q22	1071	1023	983	983
Total cold run time: 50495 ms
Total hot run time: 48679 ms

@doris-robot
Copy link

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

query5	5241	601	480	480
query6	329	230	202	202
query7	4206	448	259	259
query8	330	252	231	231
query9	8733	2897	2892	2892
query10	558	361	331	331
query11	15482	15128	14810	14810
query12	210	116	114	114
query13	1256	466	380	380
query14	7390	3096	2802	2802
query14_1	2692	2679	2783	2679
query15	209	195	172	172
query16	989	503	486	486
query17	1212	647	547	547
query18	2705	431	330	330
query19	216	217	191	191
query20	119	117	118	117
query21	216	141	120	120
query22	4089	4235	3960	3960
query23	16330	15785	15432	15432
query23_1	15650	15761	15526	15526
query24	6864	1519	1170	1170
query24_1	1177	1149	1174	1149
query25	548	446	389	389
query26	1243	268	156	156
query27	2742	446	277	277
query28	4498	2203	2209	2203
query29	766	535	434	434
query30	320	248	207	207
query31	802	643	563	563
query32	85	77	78	77
query33	541	352	318	318
query34	915	872	539	539
query35	723	775	692	692
query36	864	839	768	768
query37	142	102	88	88
query38	2728	2713	2723	2713
query39	774	760	728	728
query39_1	708	734	733	733
query40	221	138	123	123
query41	73	70	65	65
query42	105	99	107	99
query43	443	463	413	413
query44	1309	740	800	740
query45	185	197	179	179
query46	833	950	567	567
query47	1478	1524	1433	1433
query48	307	312	242	242
query49	594	426	349	349
query50	606	264	207	207
query51	3822	3742	3676	3676
query52	101	104	93	93
query53	277	321	269	269
query54	287	272	254	254
query55	83	81	79	79
query56	318	301	294	294
query57	1023	1026	947	947
query58	273	286	260	260
query59	2015	2001	1999	1999
query60	333	336	303	303
query61	150	148	148	148
query62	393	359	307	307
query63	291	264	265	264
query64	4796	1270	935	935
query65	3851	3791	3725	3725
query66	1364	415	307	307
query67	15551	15553	15383	15383
query68	2522	1095	771	771
query69	430	353	325	325
query70	980	926	907	907
query71	323	305	281	281
query72	5252	3145	2996	2996
query73	595	728	308	308
query74	8770	8728	8598	8598
query75	2751	2827	2495	2495
query76	2260	1033	630	630
query77	362	374	299	299
query78	9708	10037	9171	9171
query79	1059	875	571	571
query80	1317	564	478	478
query81	552	263	233	233
query82	980	145	110	110
query83	324	260	248	248
query84	253	109	92	92
query85	896	486	424	424
query86	402	301	284	284
query87	2898	2888	2779	2779
query88	3466	2574	2556	2556
query89	408	362	326	326
query90	1955	177	164	164
query91	169	156	128	128
query92	79	73	70	70
query93	956	881	534	534
query94	642	321	290	290
query95	582	334	312	312
query96	626	503	231	231
query97	2339	2391	2340	2340
query98	213	200	193	193
query99	582	563	510	510
Total cold run time: 249594 ms
Total hot run time: 173713 ms

@doris-robot
Copy link

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

query1	0.06	0.04	0.04
query2	0.09	0.05	0.05
query3	0.26	0.09	0.08
query4	1.60	0.11	0.12
query5	0.26	0.25	0.27
query6	1.15	0.67	0.66
query7	0.02	0.02	0.03
query8	0.05	0.05	0.04
query9	0.58	0.51	0.48
query10	0.56	0.55	0.56
query11	0.14	0.10	0.10
query12	0.14	0.10	0.11
query13	0.60	0.57	0.58
query14	0.95	0.95	0.94
query15	0.80	0.77	0.78
query16	0.39	0.40	0.39
query17	1.07	1.03	1.05
query18	0.22	0.24	0.22
query19	1.94	1.87	1.85
query20	0.01	0.01	0.02
query21	15.46	0.27	0.14
query22	5.07	0.05	0.05
query23	15.84	0.29	0.10
query24	1.13	0.50	0.25
query25	0.08	0.06	0.05
query26	0.15	0.14	0.13
query27	0.06	0.06	0.08
query28	3.25	1.09	0.88
query29	12.52	3.86	3.14
query30	0.27	0.14	0.15
query31	2.83	0.62	0.38
query32	3.25	0.55	0.46
query33	3.02	3.02	2.99
query34	16.18	5.06	4.38
query35	4.47	4.52	4.41
query36	0.65	0.49	0.50
query37	0.10	0.07	0.07
query38	0.07	0.04	0.04
query39	0.05	0.03	0.03
query40	0.17	0.14	0.14
query41	0.09	0.04	0.03
query42	0.05	0.03	0.03
query43	0.05	0.04	0.03
Total cold run time: 95.7 s
Total hot run time: 26.68 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 28.57% (4/14) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 57.14% (8/14) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Contributor Author

englefly commented Feb 3, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17634	5191	5054	5054
q2	2016	335	189	189
q3	10195	1299	744	744
q4	10199	821	309	309
q5	7498	2145	1872	1872
q6	198	176	147	147
q7	879	732	598	598
q8	9262	1391	1078	1078
q9	5093	4773	4891	4773
q10	6760	1946	1547	1547
q11	515	309	282	282
q12	342	373	224	224
q13	17779	4033	3279	3279
q14	235	254	216	216
q15	911	836	815	815
q16	671	687	625	625
q17	636	779	474	474
q18	6864	6425	7496	6425
q19	1245	1037	653	653
q20	429	372	249	249
q21	2953	2247	2003	2003
q22	376	321	271	271
Total cold run time: 102690 ms
Total hot run time: 31827 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5470	5603	5469	5469
q2	250	334	257	257
q3	2407	2937	2502	2502
q4	1391	1825	1382	1382
q5	4644	4520	4473	4473
q6	224	194	137	137
q7	2090	1983	1812	1812
q8	2524	2514	2357	2357
q9	7287	7585	7471	7471
q10	2802	3107	2598	2598
q11	544	496	479	479
q12	674	793	629	629
q13	3912	4311	3261	3261
q14	269	283	257	257
q15	841	790	789	789
q16	643	684	631	631
q17	1068	1279	1294	1279
q18	7550	7375	7365	7365
q19	811	799	808	799
q20	1992	2052	1890	1890
q21	4478	4165	4127	4127
q22	575	535	522	522
Total cold run time: 52446 ms
Total hot run time: 50486 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.08
query2	0.10	0.04	0.04
query3	0.26	0.08	0.08
query4	1.61	0.11	0.12
query5	0.26	0.25	0.25
query6	1.17	0.68	0.67
query7	0.03	0.02	0.03
query8	0.05	0.03	0.04
query9	0.57	0.50	0.48
query10	0.55	0.55	0.56
query11	0.14	0.10	0.09
query12	0.13	0.10	0.11
query13	0.62	0.61	0.60
query14	1.06	1.07	1.07
query15	0.89	0.87	0.88
query16	0.39	0.40	0.39
query17	1.12	1.16	1.17
query18	0.22	0.21	0.21
query19	2.06	2.03	2.02
query20	0.02	0.02	0.01
query21	15.43	0.28	0.15
query22	5.20	0.05	0.05
query23	15.98	0.28	0.10
query24	1.07	0.61	0.26
query25	0.12	0.07	0.08
query26	0.14	0.14	0.13
query27	0.07	0.08	0.04
query28	3.57	1.14	0.98
query29	12.57	3.94	3.17
query30	0.28	0.13	0.11
query31	2.81	0.62	0.40
query32	3.26	0.60	0.50
query33	3.30	3.33	3.21
query34	16.22	5.36	4.74
query35	4.75	4.82	4.80
query36	0.64	0.50	0.49
query37	0.11	0.06	0.07
query38	0.07	0.04	0.04
query39	0.05	0.04	0.03
query40	0.18	0.17	0.15
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 97.29 s
Total hot run time: 28.37 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 66.67% (12/18) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Contributor Author

englefly commented Feb 4, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17665	5448	5128	5128
q2	2069	303	207	207
q3	10214	1275	733	733
q4	10195	776	317	317
q5	7499	2163	1884	1884
q6	196	179	147	147
q7	898	732	595	595
q8	9258	1366	1128	1128
q9	5158	4810	4908	4810
q10	6814	1963	1562	1562
q11	518	301	285	285
q12	339	373	221	221
q13	17788	4022	3222	3222
q14	241	233	216	216
q15	890	820	806	806
q16	676	677	612	612
q17	639	771	514	514
q18	6659	6603	7316	6603
q19	1921	1032	622	622
q20	446	391	258	258
q21	2890	2252	2034	2034
q22	362	318	287	287
Total cold run time: 103335 ms
Total hot run time: 32191 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5698	5511	5518	5511
q2	277	369	253	253
q3	2439	2863	2499	2499
q4	1491	1901	1375	1375
q5	4750	4467	4479	4467
q6	220	179	146	146
q7	2020	2004	1882	1882
q8	2735	2392	2409	2392
q9	7673	7672	7386	7386
q10	2827	3087	2748	2748
q11	581	472	462	462
q12	687	794	642	642
q13	3701	4122	3356	3356
q14	280	283	262	262
q15	860	813	803	803
q16	633	708	653	653
q17	1073	1321	1375	1321
q18	7708	7525	7231	7231
q19	810	748	789	748
q20	1967	2045	1877	1877
q21	4437	4157	3971	3971
q22	556	557	493	493
Total cold run time: 53423 ms
Total hot run time: 50478 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.05
query2	0.10	0.05	0.04
query3	0.26	0.09	0.08
query4	1.60	0.11	0.11
query5	0.26	0.25	0.26
query6	1.16	0.68	0.68
query7	0.03	0.03	0.02
query8	0.05	0.04	0.04
query9	0.56	0.50	0.49
query10	0.54	0.55	0.54
query11	0.14	0.10	0.09
query12	0.15	0.10	0.10
query13	0.62	0.60	0.62
query14	1.06	1.04	1.04
query15	0.88	0.88	0.86
query16	0.40	0.40	0.39
query17	1.12	1.12	1.13
query18	0.22	0.20	0.21
query19	2.14	1.95	2.06
query20	0.03	0.02	0.02
query21	15.39	0.25	0.14
query22	5.05	0.07	0.06
query23	15.88	0.30	0.11
query24	1.07	0.58	0.50
query25	0.12	0.06	0.08
query26	0.16	0.13	0.13
query27	0.09	0.08	0.05
query28	4.20	1.15	0.97
query29	12.57	3.89	3.15
query30	0.27	0.13	0.12
query31	2.81	0.64	0.40
query32	3.24	0.60	0.51
query33	3.28	3.20	3.24
query34	16.05	5.35	4.72
query35	4.81	4.84	4.82
query36	0.64	0.50	0.49
query37	0.11	0.07	0.07
query38	0.07	0.05	0.04
query39	0.05	0.03	0.04
query40	0.18	0.17	0.16
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 97.59 s
Total hot run time: 28.49 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 77.14% (27/35) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Contributor Author

englefly commented Feb 5, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17609	4426	4293	4293
q2	2034	371	226	226
q3	10138	1273	689	689
q4	10203	814	309	309
q5	7504	2161	1881	1881
q6	195	181	147	147
q7	874	723	577	577
q8	9253	1376	1187	1187
q9	5220	4803	4855	4803
q10	6821	1947	1565	1565
q11	507	291	282	282
q12	328	369	214	214
q13	17811	4039	3231	3231
q14	238	233	220	220
q15	896	823	802	802
q16	690	657	619	619
q17	647	810	458	458
q18	6714	6592	6475	6475
q19	1224	977	654	654
q20	367	357	243	243
q21	2515	1935	1942	1935
q22	351	309	264	264
Total cold run time: 102139 ms
Total hot run time: 31074 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4334	4348	4347	4347
q2	257	331	253	253
q3	2117	2583	2239	2239
q4	1339	1719	1299	1299
q5	4286	4174	4263	4174
q6	213	175	137	137
q7	1836	1764	1639	1639
q8	2720	2571	2423	2423
q9	7714	7564	7462	7462
q10	2782	3049	2682	2682
q11	543	462	445	445
q12	712	774	608	608
q13	3853	4468	3608	3608
q14	362	322	295	295
q15	864	808	789	789
q16	663	748	682	682
q17	1143	1429	1383	1383
q18	7995	8131	7700	7700
q19	845	846	833	833
q20	2058	2125	2018	2018
q21	4629	4263	4067	4067
q22	562	538	512	512
Total cold run time: 51827 ms
Total hot run time: 49595 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.04
query2	0.09	0.04	0.04
query3	0.26	0.08	0.09
query4	1.60	0.11	0.12
query5	0.27	0.26	0.25
query6	1.17	0.67	0.67
query7	0.04	0.03	0.02
query8	0.06	0.03	0.04
query9	0.57	0.50	0.49
query10	0.54	0.54	0.55
query11	0.14	0.10	0.10
query12	0.13	0.10	0.10
query13	0.62	0.62	0.61
query14	1.07	1.06	1.07
query15	0.89	0.87	0.88
query16	0.39	0.39	0.42
query17	1.14	1.12	1.13
query18	0.23	0.22	0.21
query19	2.09	1.91	2.02
query20	0.01	0.01	0.02
query21	15.42	0.27	0.15
query22	5.45	0.05	0.05
query23	16.04	0.28	0.10
query24	0.99	0.29	0.19
query25	0.09	0.06	0.08
query26	0.14	0.14	0.13
query27	0.09	0.07	0.08
query28	3.21	1.16	0.96
query29	12.58	3.91	3.21
query30	0.28	0.13	0.12
query31	2.81	0.65	0.40
query32	3.24	0.60	0.49
query33	3.21	3.21	3.25
query34	15.88	5.40	4.73
query35	4.80	4.76	4.88
query36	0.67	0.50	0.50
query37	0.10	0.07	0.07
query38	0.08	0.04	0.04
query39	0.05	0.03	0.03
query40	0.20	0.17	0.17
query41	0.10	0.03	0.02
query42	0.05	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 96.89 s
Total hot run time: 28.17 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 73.33% (22/30) 🎉
Increment coverage report
Complete coverage report

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

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

@englefly englefly merged commit 6031d37 into apache:master Feb 6, 2026
28 checks passed
@englefly englefly deleted the ExprIdRewriterTest branch February 6, 2026 02:38
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. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments