Skip to content

[fix](fe) Prune empty and cascading CTE plans#62828

Open
englefly wants to merge 4 commits into
apache:masterfrom
englefly:fix-cte-empty
Open

[fix](fe) Prune empty and cascading CTE plans#62828
englefly wants to merge 4 commits into
apache:masterfrom
englefly:fix-cte-empty

Conversation

@englefly
Copy link
Copy Markdown
Contributor

@englefly englefly commented Apr 24, 2026

What problem does this PR solve?

Issue Number: None

Related PR: #60601

Problem Summary: Fix optimizer-side CTE pruning so empty-relation producers, zero-consumer anchors, and cascading inline opportunities are normalized to a fixpoint before memoization, and add regression coverage for empty and cascading CTE elimination.

Release note

None

Check List (For Author)

  • Test: No need to test (user requested to skip compile and test)
  • Behavior changed: Yes (empty and cascade-pruned CTEs are normalized before memoization)
  • Does this need documentation: No

What problem does this PR solve?

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
Copy Markdown
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?

@englefly
Copy link
Copy Markdown
Contributor Author

/review

@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 82.00% (41/50) 🎉
Increment coverage report
Complete coverage report

@github-actions
Copy link
Copy Markdown
Contributor

OpenCode automated review failed and did not complete.

Error: Review step was failure (possibly timeout or cancelled)
Workflow run: https://github.com/apache/doris/actions/runs/24895847727

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 90.00% (45/50) 🎉
Increment coverage report
Complete coverage report

@morrySnow
Copy link
Copy Markdown
Contributor

/review

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

I found 2 blocking issues.

Critical checkpoint conclusions:

  • Goal of this PR: partially accomplished. The change does address empty/cascading CTE pruning in the optimizer path, and the new regression suite covers two representative plan shapes, but one fixpoint bug in the new normalization loop means cascading cleanup can still stop too early.
  • Scope/minimality: mostly focused, but the SessionVariable edit also removes a legacy variable alias unrelated to the optimizer fix.
  • Concurrency: no concurrency or locking concerns are introduced in these touched FE optimizer/session-variable paths.
  • Lifecycle/static-init: no special lifecycle or static initialization issues are involved here.
  • Configuration items: no new config was added, but an existing session variable declaration was changed in a user-visible way.
  • Compatibility: not preserved. Removing cbo_cte_inline_mode breaks existing SET / SHOW VARIABLES clients that still use the old alias.
  • Parallel code paths: the new optimizer-side normalization path is distinct from the main rewrite path, and its fixpoint detection currently relies on shallow equals() semantics that do not reflect subtree changes.
  • Special conditions/checks: the new currentPlan.equals(normalizedPlan) stop condition is not strong enough for Nereids plans.
  • Test coverage: improved for empty/cascade pruning, but still missing coverage for the shallow-equality fixpoint case and for preserving the legacy session-variable alias.
  • Test result updates: one new regression test file was added; I did not run the test suite locally in this runner.
  • Observability: no additional observability appears necessary for this change.
  • Transaction/persistence/data-write/FE-BE variable passing: not applicable for this PR.
  • Performance: no blocking performance issue identified beyond the correctness problems above.
  • Other issues: none beyond the two findings below.

User focus: /tmp/review_focus.txt contains no additional focus items, so there were no extra focus-specific findings to report.

Comment thread fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Optimizer.java Outdated
Comment thread fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@englefly
Copy link
Copy Markdown
Contributor Author

englefly commented May 9, 2026

/review

@englefly
Copy link
Copy Markdown
Contributor Author

englefly commented May 9, 2026

run buildall

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

I did not add duplicate inline comments because the remaining blocking issue is already covered by the existing review thread on SessionVariable.java: removing the cbo_cte_inline_mode alias is a user-visible compatibility break and should be restored or intentionally documented with a migration plan. The earlier Plan.equals() fixpoint issue appears addressed by the explicit changed flag in the current head.

Critical checkpoint conclusions:

  • Goal/test: The PR targets CTE pruning and cascading inline normalization, with regression coverage added for empty and cascading CTE cases.
  • Scope: The optimizer changes are focused, but the alias removal is unrelated to the optimizer fix and should not be included.
  • Concurrency/lifecycle: No new concurrent mutable state, locks, or special lifecycle hazards identified.
  • Configuration/compatibility: Compatibility issue remains for the removed session-variable alias.
  • Parallel code paths: The new normalization is applied to the base rewrite plan and CBO inline alternatives; no distinct missing path found.
  • Testing: Regression coverage exists for the main CTE pruning behavior; no additional user focus points were provided.
  • Observability/persistence/data writes: Not applicable for this optimizer-only change.
  • Performance: No blocking performance issue found in the changed code; the normalization loop is bounded by CTE removal/inlining progress.

Focus response: review_focus.txt had no additional focus points.

@englefly
Copy link
Copy Markdown
Contributor Author

englefly commented May 9, 2026

run buildall

1 similar comment
@englefly
Copy link
Copy Markdown
Contributor Author

englefly commented May 9, 2026

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17664	3848	3818	3818
q2	q3	10703	867	601	601
q4	4661	452	345	345
q5	7452	1340	1127	1127
q6	182	163	136	136
q7	894	933	757	757
q8	9305	1370	1263	1263
q9	5673	5372	5296	5296
q10	6318	2093	1797	1797
q11	469	264	249	249
q12	688	412	291	291
q13	18203	3360	2755	2755
q14	296	284	261	261
q15	q16	899	890	788	788
q17	932	955	712	712
q18	6391	5731	5516	5516
q19	1172	1234	1082	1082
q20	516	393	259	259
q21	4664	2259	1873	1873
q22	416	361	308	308
Total cold run time: 97498 ms
Total hot run time: 29234 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4164	4061	4077	4061
q2	q3	4669	4749	4191	4191
q4	2096	2168	1393	1393
q5	4984	4953	5254	4953
q6	190	162	129	129
q7	2008	1776	1718	1718
q8	3589	3216	3218	3216
q9	8546	8472	8451	8451
q10	4472	4483	4234	4234
q11	644	459	431	431
q12	720	763	538	538
q13	3258	3638	2970	2970
q14	302	316	273	273
q15	q16	758	788	686	686
q17	1385	1314	1290	1290
q18	8306	7318	7214	7214
q19	1134	1152	1182	1152
q20	2311	2305	2027	2027
q21	6365	5608	5091	5091
q22	600	535	419	419
Total cold run time: 60501 ms
Total hot run time: 54437 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17681	3887	4004	3887
q2	q3	10715	869	604	604
q4	4668	454	353	353
q5	7445	1339	1167	1167
q6	184	171	143	143
q7	899	933	747	747
q8	9313	1383	1312	1312
q9	5628	5436	5390	5390
q10	6257	2066	1810	1810
q11	464	264	258	258
q12	625	413	297	297
q13	18087	3335	2710	2710
q14	295	284	264	264
q15	q16	866	867	793	793
q17	976	1188	617	617
q18	6508	5750	5679	5679
q19	1186	1298	1058	1058
q20	509	399	261	261
q21	4478	2260	1891	1891
q22	419	361	305	305
Total cold run time: 97203 ms
Total hot run time: 29546 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4192	4118	4106	4106
q2	q3	4631	4765	4208	4208
q4	2107	2179	1397	1397
q5	4996	4957	5235	4957
q6	195	161	128	128
q7	2029	1782	1852	1782
q8	3560	3198	3309	3198
q9	8598	8547	8597	8547
q10	4508	4530	4281	4281
q11	628	426	423	423
q12	698	767	511	511
q13	3568	3558	2890	2890
q14	302	321	291	291
q15	q16	795	787	689	689
q17	1344	1327	1309	1309
q18	8099	7133	7219	7133
q19	1149	1135	1155	1135
q20	2271	2291	2007	2007
q21	6198	5497	4933	4933
q22	581	551	420	420
Total cold run time: 60449 ms
Total hot run time: 54345 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 170284 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 418be746556dd12e5577e9cadc4e7811c45adc26, data reload: false

query5	4357	660	530	530
query6	356	238	222	222
query7	4235	563	309	309
query8	339	245	224	224
query9	8849	4072	4037	4037
query10	474	358	302	302
query11	6026	2385	2211	2211
query12	192	134	129	129
query13	1313	613	435	435
query14	6865	5362	5098	5098
query14_1	4369	4395	4385	4385
query15	217	205	185	185
query16	1003	463	441	441
query17	1391	773	650	650
query18	2728	487	347	347
query19	293	195	155	155
query20	142	130	136	130
query21	214	137	117	117
query22	13702	13457	13292	13292
query23	17078	16386	16598	16386
query23_1	16243	16248	16376	16248
query24	7745	1832	1410	1410
query24_1	1382	1372	1365	1365
query25	597	533	470	470
query26	1531	335	174	174
query27	2952	594	354	354
query28	4632	2003	1964	1964
query29	1041	662	513	513
query30	341	236	197	197
query31	1109	1050	927	927
query32	82	74	70	70
query33	529	347	285	285
query34	1139	1146	636	636
query35	746	777	674	674
query36	1326	1314	1133	1133
query37	140	96	84	84
query38	3195	3132	3087	3087
query39	915	914	905	905
query39_1	886	856	872	856
query40	240	154	134	134
query41	64	59	60	59
query42	109	110	107	107
query43	321	328	279	279
query44	
query45	213	202	200	200
query46	1038	1193	727	727
query47	2297	2372	2221	2221
query48	398	410	292	292
query49	637	510	437	437
query50	722	305	214	214
query51	4316	4300	4216	4216
query52	103	102	94	94
query53	259	282	202	202
query54	309	279	249	249
query55	91	87	83	83
query56	301	313	300	300
query57	1398	1426	1316	1316
query58	298	273	250	250
query59	1561	1651	1388	1388
query60	340	335	313	313
query61	157	152	148	148
query62	671	619	572	572
query63	244	201	206	201
query64	2343	816	676	676
query65	
query66	1691	506	395	395
query67	29972	29317	29850	29317
query68	
query69	461	333	306	306
query70	1031	1007	995	995
query71	321	272	268	268
query72	3156	2924	2653	2653
query73	858	734	427	427
query74	5034	4866	4732	4732
query75	2780	2647	2323	2323
query76	2303	1139	778	778
query77	417	426	352	352
query78	12937	12967	12318	12318
query79	1511	948	721	721
query80	1397	588	478	478
query81	520	275	239	239
query82	942	161	127	127
query83	350	273	241	241
query84	266	143	118	118
query85	900	516	438	438
query86	447	323	337	323
query87	3413	3385	3229	3229
query88	3510	2653	2639	2639
query89	440	383	338	338
query90	1916	189	183	183
query91	178	178	141	141
query92	84	75	72	72
query93	1098	969	573	573
query94	704	335	306	306
query95	699	366	338	338
query96	1029	746	350	350
query97	2684	2700	2587	2587
query98	242	233	227	227
query99	1142	1109	978	978
Total cold run time: 256751 ms
Total hot run time: 170284 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 170993 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 6c75a31a3bb122377bae5c87def83c2a8efa4acd, data reload: false

query5	4324	645	543	543
query6	322	237	204	204
query7	4273	572	302	302
query8	316	237	238	237
query9	8836	4060	4062	4060
query10	441	338	290	290
query11	5844	2410	2176	2176
query12	178	130	130	130
query13	1260	608	412	412
query14	6017	5353	5028	5028
query14_1	4360	4341	4334	4334
query15	209	206	181	181
query16	997	449	449	449
query17	913	750	613	613
query18	2473	484	354	354
query19	216	205	159	159
query20	136	133	133	133
query21	216	136	115	115
query22	13551	13552	13432	13432
query23	17179	16500	16601	16500
query23_1	16427	16333	16336	16333
query24	7700	1822	1384	1384
query24_1	1390	1384	1450	1384
query25	608	525	456	456
query26	1514	326	193	193
query27	2714	591	341	341
query28	4472	1960	1936	1936
query29	976	623	509	509
query30	303	235	198	198
query31	1095	1079	941	941
query32	87	69	69	69
query33	522	342	282	282
query34	1153	1120	632	632
query35	770	790	673	673
query36	1317	1349	1209	1209
query37	153	105	91	91
query38	3174	3124	3035	3035
query39	942	947	909	909
query39_1	862	883	864	864
query40	235	165	138	138
query41	72	66	69	66
query42	115	111	107	107
query43	317	328	282	282
query44	
query45	215	203	198	198
query46	1058	1197	722	722
query47	2341	2349	2201	2201
query48	412	427	313	313
query49	652	542	429	429
query50	726	288	219	219
query51	4352	4306	4275	4275
query52	108	106	94	94
query53	256	275	213	213
query54	329	289	282	282
query55	92	91	91	91
query56	323	337	343	337
query57	1465	1377	1298	1298
query58	309	282	274	274
query59	1557	1660	1457	1457
query60	363	349	337	337
query61	184	180	174	174
query62	686	633	565	565
query63	258	209	210	209
query64	2499	873	730	730
query65	
query66	1753	512	413	413
query67	29395	29956	29174	29174
query68	
query69	454	339	311	311
query70	993	1016	973	973
query71	316	276	261	261
query72	3105	2831	2472	2472
query73	808	737	409	409
query74	5082	4934	4745	4745
query75	2804	2680	2325	2325
query76	2301	1126	744	744
query77	405	433	359	359
query78	12960	12998	12386	12386
query79	1479	1027	734	734
query80	1256	578	489	489
query81	502	279	235	235
query82	1306	157	125	125
query83	365	290	255	255
query84	308	136	112	112
query85	937	518	450	450
query86	450	347	313	313
query87	3416	3351	3209	3209
query88	3533	2705	2662	2662
query89	444	380	332	332
query90	1787	185	186	185
query91	183	170	138	138
query92	82	77	70	70
query93	959	945	566	566
query94	642	342	293	293
query95	676	467	363	363
query96	1076	784	350	350
query97	2741	2692	2606	2606
query98	242	237	235	235
query99	1085	1098	911	911
Total cold run time: 254511 ms
Total hot run time: 170993 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 85.48% (53/62) 🎉
Increment coverage report
Complete coverage report

1 similar comment
@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 85.48% (53/62) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17592	3951	3854	3854
q2	q3	10728	867	606	606
q4	4662	459	343	343
q5	7450	1321	1158	1158
q6	193	169	141	141
q7	912	947	749	749
q8	9321	1394	1253	1253
q9	5523	5396	5356	5356
q10	6244	2097	1820	1820
q11	476	263	257	257
q12	627	420	296	296
q13	18098	3308	2727	2727
q14	286	281	262	262
q15	q16	885	866	786	786
q17	927	1012	707	707
q18	6478	5740	5577	5577
q19	1154	1260	1051	1051
q20	495	395	264	264
q21	4835	2382	1994	1994
q22	461	411	338	338
Total cold run time: 97347 ms
Total hot run time: 29539 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4764	4667	4841	4667
q2	q3	4653	4864	4166	4166
q4	2106	2165	1385	1385
q5	4977	4978	5202	4978
q6	190	177	142	142
q7	2089	1816	1623	1623
q8	3321	3059	3120	3059
q9	8541	8105	8473	8105
q10	4540	4519	4227	4227
q11	596	413	392	392
q12	700	744	535	535
q13	3193	3611	2882	2882
q14	301	296	270	270
q15	q16	878	806	684	684
q17	1338	1279	1251	1251
q18	7942	7057	7129	7057
q19	1129	1176	1143	1143
q20	2269	2241	1955	1955
q21	6254	5350	4904	4904
q22	539	511	410	410
Total cold run time: 60320 ms
Total hot run time: 53835 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4312	650	519	519
query6	350	209	193	193
query7	4226	582	321	321
query8	336	227	214	214
query9	8840	3988	4020	3988
query10	446	358	297	297
query11	5902	2394	2193	2193
query12	180	130	124	124
query13	1270	616	428	428
query14	6043	5387	5054	5054
query14_1	4392	4437	4394	4394
query15	214	215	185	185
query16	991	472	445	445
query17	953	769	637	637
query18	2503	491	371	371
query19	227	209	165	165
query20	138	137	133	133
query21	219	141	120	120
query22	13618	13930	14595	13930
query23	17434	16542	16162	16162
query23_1	16324	16328	16284	16284
query24	7409	1752	1341	1341
query24_1	1335	1332	1373	1332
query25	557	493	415	415
query26	1291	316	177	177
query27	2716	600	344	344
query28	4419	1962	1960	1960
query29	989	630	515	515
query30	306	235	200	200
query31	1092	1057	941	941
query32	79	70	70	70
query33	538	340	295	295
query34	1149	1105	633	633
query35	743	773	675	675
query36	1341	1334	1171	1171
query37	145	94	97	94
query38	3157	3109	3073	3073
query39	913	938	893	893
query39_1	882	871	863	863
query40	229	152	135	135
query41	62	60	60	60
query42	109	106	101	101
query43	317	334	276	276
query44	
query45	214	202	190	190
query46	1048	1178	718	718
query47	2281	2289	2182	2182
query48	375	396	296	296
query49	631	520	424	424
query50	710	280	222	222
query51	4283	4264	4188	4188
query52	109	105	96	96
query53	260	289	207	207
query54	320	285	254	254
query55	100	90	83	83
query56	304	316	299	299
query57	1403	1395	1319	1319
query58	289	279	284	279
query59	1528	1627	1451	1451
query60	356	327	325	325
query61	155	154	154	154
query62	673	624	576	576
query63	253	196	212	196
query64	2446	833	692	692
query65	
query66	1734	527	387	387
query67	29965	29905	29862	29862
query68	
query69	461	332	303	303
query70	958	994	1026	994
query71	311	275	259	259
query72	3020	2733	2644	2644
query73	815	740	432	432
query74	5062	4886	4738	4738
query75	2804	2683	2355	2355
query76	2307	1138	789	789
query77	419	423	341	341
query78	12935	13006	12315	12315
query79	1508	1028	718	718
query80	1386	572	476	476
query81	521	284	237	237
query82	958	155	127	127
query83	324	275	256	256
query84	301	143	111	111
query85	908	509	444	444
query86	444	316	298	298
query87	3407	3365	3227	3227
query88	3559	2691	2661	2661
query89	436	378	337	337
query90	1945	182	183	182
query91	181	168	138	138
query92	79	78	72	72
query93	1224	936	577	577
query94	712	329	291	291
query95	663	367	346	346
query96	1044	780	324	324
query97	2698	2694	2547	2547
query98	236	234	237	234
query99	1144	1101	963	963
Total cold run time: 253938 ms
Total hot run time: 171356 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 85.48% (53/62) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 56.00% (56/100) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17818	4066	4066	4066
q2	q3	10720	856	598	598
q4	4672	453	344	344
q5	7471	1311	1140	1140
q6	190	166	140	140
q7	912	962	751	751
q8	9611	1321	1263	1263
q9	6139	5351	5305	5305
q10	6311	2046	1789	1789
q11	468	265	247	247
q12	690	417	287	287
q13	18201	3312	2708	2708
q14	297	281	263	263
q15	q16	903	863	785	785
q17	1050	929	775	775
q18	6348	5718	5537	5537
q19	1491	1220	1079	1079
q20	527	390	262	262
q21	4748	2317	1918	1918
q22	486	405	339	339
Total cold run time: 99053 ms
Total hot run time: 29596 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4666	4540	4592	4540
q2	q3	4668	4773	4206	4206
q4	2071	2151	1378	1378
q5	4934	5094	5242	5094
q6	210	168	139	139
q7	2039	1828	1638	1638
q8	3347	3084	3129	3084
q9	8380	8658	8365	8365
q10	4456	4461	4233	4233
q11	574	407	411	407
q12	703	754	514	514
q13	3290	3629	2907	2907
q14	293	312	281	281
q15	q16	775	773	682	682
q17	1334	1296	1246	1246
q18	7991	7186	7101	7101
q19	1158	1157	1133	1133
q20	2173	2200	1906	1906
q21	5917	5244	4723	4723
q22	509	464	398	398
Total cold run time: 59488 ms
Total hot run time: 53975 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4307	653	513	513
query6	311	219	210	210
query7	4281	583	305	305
query8	325	244	248	244
query9	8850	4114	4074	4074
query10	456	338	298	298
query11	5781	2384	2200	2200
query12	183	129	130	129
query13	1291	601	422	422
query14	6503	5387	5083	5083
query14_1	4409	4416	4375	4375
query15	215	205	195	195
query16	999	460	450	450
query17	1160	780	607	607
query18	2707	486	340	340
query19	221	206	163	163
query20	138	131	138	131
query21	220	146	116	116
query22	13558	13548	13520	13520
query23	17056	16308	15999	15999
query23_1	15960	16127	16128	16127
query24	7423	1731	1360	1360
query24_1	1371	1366	1371	1366
query25	551	496	444	444
query26	1290	325	171	171
query27	2719	636	342	342
query28	4416	1963	2004	1963
query29	1020	620	514	514
query30	330	241	210	210
query31	1128	1062	921	921
query32	91	73	77	73
query33	547	349	284	284
query34	1157	1133	660	660
query35	763	786	662	662
query36	1307	1304	1178	1178
query37	157	108	98	98
query38	3219	3122	3078	3078
query39	922	928	949	928
query39_1	891	880	876	876
query40	234	165	143	143
query41	64	64	62	62
query42	111	118	111	111
query43	336	336	297	297
query44	
query45	207	198	193	193
query46	1121	1218	724	724
query47	2295	2327	2230	2230
query48	366	410	324	324
query49	669	558	470	470
query50	731	312	233	233
query51	4357	4300	4268	4268
query52	106	111	100	100
query53	275	303	228	228
query54	333	313	272	272
query55	98	102	91	91
query56	325	338	329	329
query57	1469	1465	1321	1321
query58	308	294	284	284
query59	1624	1678	1403	1403
query60	368	358	335	335
query61	183	180	179	179
query62	691	637	567	567
query63	263	215	231	215
query64	2471	870	732	732
query65	
query66	1749	545	452	452
query67	29301	29855	29797	29797
query68	
query69	470	331	301	301
query70	1038	962	1029	962
query71	315	281	270	270
query72	3028	2702	2395	2395
query73	825	785	454	454
query74	5089	4886	4725	4725
query75	2780	2677	2311	2311
query76	2297	1146	808	808
query77	431	434	358	358
query78	12843	12965	12238	12238
query79	1468	1025	719	719
query80	1343	625	485	485
query81	522	277	241	241
query82	942	163	132	132
query83	365	277	250	250
query84	269	141	108	108
query85	908	507	443	443
query86	463	319	305	305
query87	3447	3346	3207	3207
query88	3617	2670	2646	2646
query89	455	392	353	353
query90	1932	189	182	182
query91	179	169	137	137
query92	77	81	69	69
query93	1206	972	575	575
query94	725	317	301	301
query95	663	459	342	342
query96	1098	774	321	321
query97	2674	2685	2563	2563
query98	237	226	223	223
query99	1111	1095	956	956
Total cold run time: 253869 ms
Total hot run time: 170170 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 85.48% (53/62) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 85.48% (53/62) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 91.94% (57/62) 🎉
Increment coverage report
Complete coverage report

Issue Number: None

Related PR: None

Problem Summary: Fix optimizer-side CTE pruning so empty-relation producers, zero-consumer anchors, and cascading inline opportunities are normalized to a fixpoint before memoization, and add regression coverage for empty and cascading CTE elimination.

None

- Test: No need to test (user requested to skip compile and test)
- Behavior changed: Yes (empty and cascade-pruned CTEs are normalized before memoization)
- Does this need documentation: No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

[fix](fe) Fix cascading CTE normalize fixpoint

Issue Number: close #xxx

Related PR: #xxx

Problem Summary: CTE normalization used Plan.equals() as the fixpoint check. Some logical plan nodes do not compare children in equals(), so CTE rewrites under a kept parent node could be missed and cascading inline/prune normalization could stop too early.

Fix cascading CTE pruning/inline normalization when child CTE changes occur under logical nodes whose equals() does not compare children.

- Test: Regression test / FE checkstyle
    - ./run-regression-test.sh --run -d query_p0/cte -s test_cbo_cte_inline_prune
    - cd fe && mvn checkstyle:check -pl fe-core
- Behavior changed: Yes. CTE normalization now uses explicit rewrite state instead of shallow Plan.equals() for fixpoint detection.
- Does this need documentation: No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

[fix](regression) Update repeat CTE shape expectation

Issue Number: close #xxx

Related PR: #xxx

Problem Summary: CTE normalization now inlines the single-consumer CTE in the repeat output slot shape case, so the expected shape output needed to be updated while query results stay unchanged.

None

- Test: Regression test
    - ./run-regression-test.sh --run -d query_p0/repeat -s test_repeat_output_slot
- Behavior changed: No. Test expectation only.
- Does this need documentation: No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

fix-shape
@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17610	3865	3821	3821
q2	q3	10711	866	591	591
q4	4665	458	346	346
q5	7466	1323	1132	1132
q6	181	166	136	136
q7	936	927	763	763
q8	9306	1389	1331	1331
q9	5645	5360	5310	5310
q10	6263	2055	1808	1808
q11	485	267	266	266
q12	632	410	289	289
q13	18104	3277	2715	2715
q14	297	287	259	259
q15	q16	906	859	790	790
q17	1022	1014	752	752
q18	6453	5661	5484	5484
q19	1184	1280	1068	1068
q20	505	391	256	256
q21	4507	2370	1957	1957
q22	483	431	374	374
Total cold run time: 97361 ms
Total hot run time: 29448 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4789	4715	4797	4715
q2	q3	4655	4776	4233	4233
q4	2104	2249	1421	1421
q5	4940	4981	5288	4981
q6	204	172	133	133
q7	2037	1792	1610	1610
q8	3366	3135	3126	3126
q9	8423	8413	8441	8413
q10	4544	4485	4225	4225
q11	610	422	421	421
q12	712	744	516	516
q13	3306	3565	2894	2894
q14	310	299	268	268
q15	q16	765	905	690	690
q17	1357	1297	1251	1251
q18	8045	7149	7081	7081
q19	1155	1142	1146	1142
q20	2233	2217	1932	1932
q21	6076	5438	4912	4912
q22	555	521	419	419
Total cold run time: 60186 ms
Total hot run time: 54383 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 170881 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 1faf7e2dc3e47bdea6a9b72130986799d1f590cd, data reload: false

query5	4331	654	520	520
query6	327	219	198	198
query7	4256	565	317	317
query8	330	232	215	215
query9	8817	3956	4010	3956
query10	464	340	300	300
query11	5803	2361	2192	2192
query12	173	128	126	126
query13	1282	652	444	444
query14	5985	5371	5006	5006
query14_1	4313	4320	4317	4317
query15	215	201	180	180
query16	1024	465	414	414
query17	1125	783	608	608
query18	2453	482	348	348
query19	219	195	164	164
query20	138	135	133	133
query21	214	136	113	113
query22	13547	13608	13371	13371
query23	17199	16374	16619	16374
query23_1	16456	16362	16480	16362
query24	7653	1808	1407	1407
query24_1	1404	1397	1397	1397
query25	584	504	450	450
query26	1318	321	172	172
query27	2755	582	340	340
query28	4456	1961	1953	1953
query29	1021	662	542	542
query30	312	237	198	198
query31	1111	1073	918	918
query32	87	76	74	74
query33	558	363	302	302
query34	1180	1120	664	664
query35	783	792	671	671
query36	1350	1365	1141	1141
query37	150	103	93	93
query38	3225	3125	3094	3094
query39	928	914	893	893
query39_1	883	876	877	876
query40	244	164	142	142
query41	69	69	64	64
query42	108	107	112	107
query43	326	324	296	296
query44	
query45	211	206	201	201
query46	1111	1235	750	750
query47	2368	2333	2250	2250
query48	396	413	284	284
query49	627	529	423	423
query50	735	279	212	212
query51	4341	4263	4184	4184
query52	107	106	91	91
query53	251	272	202	202
query54	316	269	248	248
query55	91	87	83	83
query56	300	303	311	303
query57	1425	1410	1317	1317
query58	293	272	263	263
query59	1562	1603	1427	1427
query60	336	341	323	323
query61	160	160	159	159
query62	691	628	532	532
query63	238	194	201	194
query64	2445	838	701	701
query65	
query66	1724	516	399	399
query67	30068	30023	29862	29862
query68	
query69	443	340	299	299
query70	1052	997	944	944
query71	298	286	283	283
query72	2976	2699	2528	2528
query73	836	739	448	448
query74	5084	4883	4771	4771
query75	2798	2648	2326	2326
query76	2300	1163	773	773
query77	423	439	367	367
query78	12959	13044	12490	12490
query79	1450	1052	742	742
query80	721	569	484	484
query81	453	277	242	242
query82	1355	156	120	120
query83	328	279	251	251
query84	264	135	109	109
query85	859	517	464	464
query86	400	332	333	332
query87	3448	3361	3197	3197
query88	3574	2685	2669	2669
query89	438	387	332	332
query90	1979	178	182	178
query91	180	172	143	143
query92	90	77	72	72
query93	1036	949	557	557
query94	534	356	296	296
query95	663	370	428	370
query96	1060	742	346	346
query97	2713	2705	2556	2556
query98	233	228	227	227
query99	1109	1138	999	999
Total cold run time: 253881 ms
Total hot run time: 170881 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 82.61% (57/69) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 80.56% (58/72) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17595	3862	3835	3835
q2	q3	10725	879	594	594
q4	4662	463	346	346
q5	7455	1326	1140	1140
q6	221	165	139	139
q7	923	954	764	764
q8	9738	1359	1327	1327
q9	6217	5411	5321	5321
q10	6341	2083	1818	1818
q11	475	266	248	248
q12	688	420	290	290
q13	18381	3292	2799	2799
q14	289	284	262	262
q15	q16	907	878	799	799
q17	989	1077	761	761
q18	6496	5712	5625	5625
q19	1349	1297	1086	1086
q20	512	411	265	265
q21	4951	2369	1940	1940
q22	484	387	328	328
Total cold run time: 99398 ms
Total hot run time: 29687 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4607	4501	4585	4501
q2	q3	4648	4768	4225	4225
q4	2118	2184	1398	1398
q5	5017	4994	5446	4994
q6	201	173	133	133
q7	2030	1843	1602	1602
q8	3335	3085	3139	3085
q9	8421	8635	8340	8340
q10	4511	4496	4242	4242
q11	605	404	405	404
q12	717	733	519	519
q13	3160	3596	2937	2937
q14	302	300	278	278
q15	q16	765	787	682	682
q17	1350	1333	1284	1284
q18	7919	7070	7056	7056
q19	1160	1162	1159	1159
q20	2271	2275	1973	1973
q21	6137	5401	4811	4811
q22	525	474	398	398
Total cold run time: 59799 ms
Total hot run time: 54021 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 170622 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 833fc19b502172dbf0d7961cd4aa6d3d1d36247d, data reload: false

query5	4332	646	503	503
query6	348	215	197	197
query7	4245	552	316	316
query8	330	225	215	215
query9	8797	4024	3982	3982
query10	456	341	301	301
query11	5770	2392	2207	2207
query12	182	136	128	128
query13	1278	584	451	451
query14	6340	5756	5046	5046
query14_1	4350	4373	4331	4331
query15	217	209	184	184
query16	1039	463	442	442
query17	1161	801	646	646
query18	2755	505	366	366
query19	226	218	171	171
query20	143	134	132	132
query21	225	142	120	120
query22	13605	13615	13389	13389
query23	17249	16431	16047	16047
query23_1	16191	16201	16110	16110
query24	7444	1743	1338	1338
query24_1	1323	1329	1337	1329
query25	587	483	449	449
query26	1304	325	170	170
query27	2677	592	331	331
query28	4379	1950	1987	1950
query29	1018	626	514	514
query30	309	234	200	200
query31	1134	1055	944	944
query32	85	76	73	73
query33	588	351	317	317
query34	1172	1153	644	644
query35	750	787	665	665
query36	1357	1316	1149	1149
query37	157	100	98	98
query38	3194	3133	3024	3024
query39	947	942	893	893
query39_1	867	878	879	878
query40	240	157	135	135
query41	66	64	61	61
query42	112	108	107	107
query43	332	323	277	277
query44	
query45	213	202	192	192
query46	1059	1137	713	713
query47	2346	2340	2197	2197
query48	402	406	288	288
query49	634	522	419	419
query50	705	294	212	212
query51	4290	4216	4180	4180
query52	103	102	93	93
query53	251	279	197	197
query54	318	276	247	247
query55	93	88	82	82
query56	292	300	297	297
query57	1402	1409	1319	1319
query58	302	261	266	261
query59	1588	1661	1433	1433
query60	343	328	320	320
query61	164	155	155	155
query62	718	615	555	555
query63	240	204	210	204
query64	2357	808	678	678
query65	
query66	1694	511	390	390
query67	30026	29332	29831	29332
query68	
query69	448	339	309	309
query70	1049	990	919	919
query71	298	274	266	266
query72	3152	2947	2615	2615
query73	895	757	434	434
query74	5092	4894	4729	4729
query75	2763	2648	2338	2338
query76	2287	1136	760	760
query77	418	430	347	347
query78	12918	12869	12455	12455
query79	1585	1010	755	755
query80	1383	572	511	511
query81	531	282	239	239
query82	924	162	125	125
query83	345	280	249	249
query84	261	151	110	110
query85	889	531	437	437
query86	479	329	339	329
query87	3413	3324	3204	3204
query88	3541	2661	2660	2660
query89	453	381	337	337
query90	1970	176	178	176
query91	177	169	137	137
query92	78	78	74	74
query93	1100	950	566	566
query94	754	348	283	283
query95	672	389	444	389
query96	1034	791	339	339
query97	2686	2708	2581	2581
query98	259	236	235	235
query99	1127	1099	983	983
Total cold run time: 254745 ms
Total hot run time: 170622 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 32.49% (64/197) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17631	3849	3794	3794
q2	q3	10729	858	599	599
q4	4659	456	339	339
q5	7453	1307	1137	1137
q6	182	172	134	134
q7	903	955	724	724
q8	9309	1402	1232	1232
q9	5566	5364	5336	5336
q10	6311	2062	1809	1809
q11	469	278	252	252
q12	651	415	294	294
q13	18153	3506	2724	2724
q14	285	283	264	264
q15	q16	895	878	793	793
q17	994	1092	751	751
q18	6461	5625	5545	5545
q19	1215	1187	1051	1051
q20	509	408	275	275
q21	4579	2294	1919	1919
q22	465	390	325	325
Total cold run time: 97419 ms
Total hot run time: 29297 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4686	4515	4710	4515
q2	q3	4707	4770	4193	4193
q4	2078	2139	1364	1364
q5	4941	4995	5228	4995
q6	192	169	136	136
q7	2042	1841	1641	1641
q8	3327	3069	3051	3051
q9	8355	8496	8335	8335
q10	4513	4490	4235	4235
q11	581	428	393	393
q12	686	734	509	509
q13	3308	3578	2912	2912
q14	313	321	268	268
q15	q16	776	796	681	681
q17	1307	1297	1231	1231
q18	7802	6992	7003	6992
q19	1204	1146	1150	1146
q20	2260	2240	1983	1983
q21	6074	5319	4795	4795
q22	543	497	402	402
Total cold run time: 59695 ms
Total hot run time: 53777 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 168555 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 576ac17c2f9f56851b2490a00bee950cdcd436ff, data reload: false

query5	4331	644	516	516
query6	341	219	199	199
query7	4310	558	315	315
query8	316	232	211	211
query9	8836	3991	3974	3974
query10	493	337	289	289
query11	5799	2360	2200	2200
query12	178	132	125	125
query13	1282	620	424	424
query14	6020	5327	5031	5031
query14_1	4319	4299	4319	4299
query15	212	205	192	192
query16	1005	464	436	436
query17	1154	752	644	644
query18	2759	516	365	365
query19	224	212	173	173
query20	147	135	134	134
query21	220	145	117	117
query22	13542	13628	13396	13396
query23	17143	16293	15968	15968
query23_1	16105	16117	16080	16080
query24	7351	1799	1340	1340
query24_1	1402	1335	1353	1335
query25	557	510	433	433
query26	1293	306	173	173
query27	2726	559	334	334
query28	4405	1940	1933	1933
query29	983	633	501	501
query30	303	238	198	198
query31	1122	1071	938	938
query32	85	73	74	73
query33	553	343	285	285
query34	1160	1108	654	654
query35	771	770	655	655
query36	1305	1350	1143	1143
query37	148	105	91	91
query38	3232	3134	3076	3076
query39	937	929	929	929
query39_1	879	887	863	863
query40	242	156	134	134
query41	65	64	65	64
query42	108	115	109	109
query43	321	327	277	277
query44	
query45	212	198	192	192
query46	1107	1151	713	713
query47	2309	2301	2105	2105
query48	404	418	305	305
query49	640	543	418	418
query50	723	294	211	211
query51	4294	4275	4211	4211
query52	103	103	94	94
query53	252	278	205	205
query54	307	284	247	247
query55	97	96	89	89
query56	292	305	310	305
query57	1446	1454	1361	1361
query58	305	270	265	265
query59	1545	1663	1396	1396
query60	344	334	324	324
query61	162	148	155	148
query62	682	626	551	551
query63	252	203	220	203
query64	2481	820	668	668
query65	
query66	1711	515	395	395
query67	29902	29324	29090	29090
query68	
query69	453	338	301	301
query70	1016	997	993	993
query71	306	272	262	262
query72	2882	2696	2366	2366
query73	808	770	440	440
query74	5108	4870	4712	4712
query75	2744	2648	2318	2318
query76	2261	1140	755	755
query77	407	418	341	341
query78	12936	12883	12374	12374
query79	1491	1020	729	729
query80	680	570	493	493
query81	448	275	233	233
query82	1373	159	123	123
query83	358	281	246	246
query84	261	139	120	120
query85	854	505	446	446
query86	405	360	321	321
query87	3389	3355	3217	3217
query88	3602	2708	2702	2702
query89	439	379	335	335
query90	1885	177	180	177
query91	176	174	135	135
query92	78	73	76	73
query93	960	986	583	583
query94	535	349	291	291
query95	659	470	343	343
query96	1091	747	351	351
query97	2686	2675	2541	2541
query98	231	225	222	222
query99	1081	1139	961	961
Total cold run time: 252810 ms
Total hot run time: 168555 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 88.89% (64/72) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17769	3851	3967	3851
q2	q3	10725	870	614	614
q4	4663	455	350	350
q5	7465	1315	1151	1151
q6	190	175	144	144
q7	915	931	746	746
q8	9288	1402	1290	1290
q9	5582	5369	5324	5324
q10	6299	2120	1793	1793
q11	470	269	261	261
q12	688	419	294	294
q13	18518	3222	2690	2690
q14	301	280	266	266
q15	q16	891	866	790	790
q17	1015	1128	688	688
q18	6374	5725	5567	5567
q19	1170	1209	1071	1071
q20	503	399	260	260
q21	4532	2258	1892	1892
q22	417	365	313	313
Total cold run time: 97775 ms
Total hot run time: 29355 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4254	4116	4123	4116
q2	q3	4626	4781	4187	4187
q4	2092	2150	1389	1389
q5	4966	4895	5110	4895
q6	188	164	132	132
q7	2070	1805	1766	1766
q8	3482	3207	3171	3171
q9	8496	8487	8503	8487
q10	4490	4518	4235	4235
q11	624	454	408	408
q12	679	792	528	528
q13	3248	3571	2986	2986
q14	305	315	274	274
q15	q16	748	763	697	697
q17	1363	1318	1278	1278
q18	8136	7203	7173	7173
q19	1146	1176	1162	1162
q20	2263	2251	1971	1971
q21	6175	5461	5014	5014
q22	538	503	436	436
Total cold run time: 59889 ms
Total hot run time: 54305 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4326	676	523	523
query6	339	218	199	199
query7	4270	586	299	299
query8	320	258	229	229
query9	8858	4014	4051	4014
query10	471	365	306	306
query11	6024	2429	2223	2223
query12	193	134	134	134
query13	1299	624	429	429
query14	6808	5379	5079	5079
query14_1	4357	4392	4386	4386
query15	216	206	187	187
query16	1045	468	451	451
query17	1154	796	651	651
query18	2768	505	376	376
query19	245	216	173	173
query20	142	131	136	131
query21	223	147	128	128
query22	13611	14007	14476	14007
query23	17413	16563	16139	16139
query23_1	16304	16219	16346	16219
query24	7668	1821	1350	1350
query24_1	1398	1350	1346	1346
query25	525	482	425	425
query26	1277	328	168	168
query27	2681	631	339	339
query28	4329	1993	1946	1946
query29	978	626	505	505
query30	306	237	192	192
query31	1143	1064	939	939
query32	81	70	69	69
query33	521	354	292	292
query34	1157	1135	643	643
query35	774	786	687	687
query36	1324	1367	1191	1191
query37	149	102	86	86
query38	3213	3134	3082	3082
query39	930	916	898	898
query39_1	879	857	863	857
query40	236	153	139	139
query41	67	64	60	60
query42	109	106	105	105
query43	326	329	283	283
query44	
query45	206	197	194	194
query46	1044	1199	743	743
query47	2318	2316	2147	2147
query48	399	417	328	328
query49	637	540	441	441
query50	741	297	216	216
query51	4279	4246	4190	4190
query52	111	106	93	93
query53	260	294	209	209
query54	338	275	274	274
query55	94	90	85	85
query56	301	304	311	304
query57	1411	1370	1336	1336
query58	291	270	266	266
query59	1583	1649	1404	1404
query60	342	338	322	322
query61	159	156	156	156
query62	670	619	560	560
query63	260	206	205	205
query64	2329	851	673	673
query65	
query66	1679	542	397	397
query67	30048	29899	29767	29767
query68	
query69	456	351	306	306
query70	1041	981	986	981
query71	311	284	277	277
query72	3030	2791	2423	2423
query73	834	757	390	390
query74	5079	4924	4754	4754
query75	2844	2663	2344	2344
query76	2292	1208	823	823
query77	420	430	358	358
query78	12792	13025	12385	12385
query79	1520	1021	766	766
query80	1392	591	481	481
query81	518	276	246	246
query82	1014	166	122	122
query83	334	281	244	244
query84	253	162	111	111
query85	897	525	452	452
query86	454	360	329	329
query87	3456	3359	3207	3207
query88	3635	2714	2669	2669
query89	458	374	337	337
query90	1986	185	184	184
query91	179	168	145	145
query92	82	79	73	73
query93	1167	953	564	564
query94	715	357	304	304
query95	668	490	351	351
query96	1046	776	314	314
query97	2736	2732	2552	2552
query98	243	235	224	224
query99	1112	1101	968	968
Total cold run time: 255723 ms
Total hot run time: 171694 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 80.56% (58/72) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 91.67% (66/72) 🎉
Increment coverage report
Complete coverage report

@englefly
Copy link
Copy Markdown
Contributor Author

run cloud_p0

@englefly
Copy link
Copy Markdown
Contributor Author

/review

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 75.00% (66/88) 🎉
Increment coverage report
Complete coverage report

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

I found one additional issue beyond the existing review threads. The existing alias-removal compatibility concern in SessionVariable also still appears unresolved in the current diff, but I did not duplicate that inline comment.

Critical checkpoint conclusions:

  • Goal/test: the PR targets CTE empty-prune and cascading inline normalization, and adds focused regression coverage, but the implementation leaves optimizer CTE bookkeeping stale after mutating the rewrite plan.
  • Scope: the change is generally focused, but the new normalization hook needs to maintain existing StatementContext invariants.
  • Concurrency/lifecycle: no new concurrent execution path or special lifecycle issue found.
  • Config/compatibility: no new config is added; the removed cbo_cte_inline_mode alias is an existing user-visible compatibility issue already raised in a prior thread.
  • Parallel paths: CTE consumer/producer bookkeeping paths used by costing and runtime filter generation are not updated after this new normalization path.
  • Tests: regression tests cover plan-shape normalization, but they do not cover stale CTE consumer metadata effects on costing/runtime-filter decisions.
  • Observability/transactions/persistence: not applicable.
  • Performance: stale consumer counts can mis-cost remaining CTE producers/consumers and can suppress runtime-filter pushdown.

User focus: no additional user-provided review focus was supplied.

public void execute() {
MoreFieldsThread.keepFunctionSignature(() -> {
Plan rewritePlan = cascadesContext.getRewritePlan();
if (containsCte(rewritePlan)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After this replaces the rewrite plan, the CTE bookkeeping in StatementContext still describes the pre-normalized tree populated by CTEInline/RewriteCteChildren. That metadata is used later by CostModel (getCteIdToConsumers() for the consumer count and getCteProducerByCteId() for producer shape) and by runtime-filter pushdown to decide whether all CTE consumers have filters. A concrete case is a CTE with three consumers where normalizeCtePlan() eliminates one empty branch but leaves the CTE materialized with two consumers: the memo is built from the two-consumer plan, while StatementContext.getCteIdToConsumers() still reports three, so the materialized CTE can be over-costed as the numConsumers >= 3 UNION ALL case and runtime-filter pushdown can be skipped because it waits for a non-existent third consumer. Please refresh/clear and rebuild the CTE producer/consumer context after normalization before toMemo() and CBO costing run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants