Skip to content

[cleanup](build) Replace runtime_state.h include with forward declaration in 14 headers#61549

Open
shuke987 wants to merge 2 commits intoapache:masterfrom
shuke987:iwyu-fwd-decl-runtime-state
Open

[cleanup](build) Replace runtime_state.h include with forward declaration in 14 headers#61549
shuke987 wants to merge 2 commits intoapache:masterfrom
shuke987:iwyu-fwd-decl-runtime-state

Conversation

@shuke987
Copy link
Collaborator

Summary

  • Replace #include "runtime/runtime_state.h" with class RuntimeState; forward declaration in 14 header files
  • These headers only use RuntimeState* as pointer/reference parameters — they never access RuntimeState members or methods
  • For files with corresponding .cpp, the full #include is preserved in the .cpp

This reduces the transitive include fan-out from runtime_state.h, which pulls in heavy protobuf/thrift generated headers. This should improve incremental build times for files that depend on these 14 headers.

Modified headers:

hash_table_set_build.h, runtime_filter_producer_helper_{cross,set}.h, tablet_sink_hash_partitioner.h, lambda_function.h, short_circuit_evaluation_expr.h, vcolumn_ref.h, vcondition_expr.h, vectorized_fn_call.h, vexpr_context.h, vtopn_pred.h, task_execution_context.h, collection_statistics.h, ann_topn_runtime.h, rowset_reader_context.h

Test plan

  • Full BE build (1522 targets) passes with zero compilation errors
  • CI pipeline

🤖 Generated with Claude Code

…ation in 14 headers

In 14 header files, runtime_state.h was included but RuntimeState was only
used as a pointer/reference parameter. Replace with forward declaration
to reduce header dependency fan-out and improve incremental build times.

For header-only files, added "class RuntimeState;" forward declaration.
For files with corresponding .cpp, ensured the .cpp has the full include.

Verified: full BE build passes with zero compilation errors.
@hello-stephen
Copy link
Contributor

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

Please clearly describe your PR:

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

@shuke987 shuke987 requested review from BiteTheDDDDt and yiguolei and removed request for yiguolei March 20, 2026 07:18
@shuke987
Copy link
Collaborator Author

run buildall

Move #include "runtime/runtime_state.h" to correct position in project
includes section and expand single-line namespace to multi-line format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shuke987
Copy link
Collaborator Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 27060 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit a3f77177e8929a6bbc5c34c2af1ed9e19ee238a1, 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	17674	4613	4317	4317
q2	q3	10635	840	532	532
q4	4724	361	261	261
q5	7864	1220	1026	1026
q6	205	169	147	147
q7	816	867	677	677
q8	10347	1471	1362	1362
q9	6652	4744	4754	4744
q10	6336	1925	1649	1649
q11	453	260	238	238
q12	749	586	466	466
q13	18060	2984	2188	2188
q14	234	229	220	220
q15	q16	767	749	687	687
q17	734	845	439	439
q18	5971	5518	5324	5324
q19	1256	998	615	615
q20	540	491	381	381
q21	4843	2017	1511	1511
q22	377	346	276	276
Total cold run time: 99237 ms
Total hot run time: 27060 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	4791	4763	4635	4635
q2	q3	3936	4332	3829	3829
q4	863	1216	776	776
q5	4076	4418	4381	4381
q6	188	185	143	143
q7	1836	1657	1556	1556
q8	2494	2808	2591	2591
q9	7556	7412	7427	7412
q10	3880	3966	3574	3574
q11	525	432	429	429
q12	492	598	481	481
q13	2851	3185	2311	2311
q14	289	314	271	271
q15	q16	723	774	766	766
q17	1132	1264	1344	1264
q18	7227	7100	6676	6676
q19	974	900	899	899
q20	2093	2192	1985	1985
q21	4037	3459	3345	3345
q22	466	428	404	404
Total cold run time: 50429 ms
Total hot run time: 47728 ms

@doris-robot
Copy link

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

query5	4336	622	510	510
query6	329	226	206	206
query7	4223	459	273	273
query8	363	242	257	242
query9	8695	2759	2770	2759
query10	536	382	332	332
query11	7005	5089	4876	4876
query12	186	129	125	125
query13	1277	482	346	346
query14	5810	3706	3440	3440
query14_1	2848	2820	2802	2802
query15	214	193	178	178
query16	1011	477	452	452
query17	1038	756	632	632
query18	2470	468	358	358
query19	225	213	195	195
query20	140	127	129	127
query21	213	137	111	111
query22	13213	13340	13074	13074
query23	15836	15464	15557	15464
query23_1	15938	15711	16116	15711
query24	7567	1720	1257	1257
query24_1	1311	1297	1269	1269
query25	574	486	451	451
query26	1350	274	153	153
query27	3411	505	336	336
query28	4795	1863	1844	1844
query29	848	570	481	481
query30	299	229	190	190
query31	1019	965	873	873
query32	79	75	71	71
query33	511	324	272	272
query34	878	904	536	536
query35	646	685	601	601
query36	1074	1118	1012	1012
query37	137	102	85	85
query38	2945	2911	2897	2897
query39	861	842	824	824
query39_1	803	796	783	783
query40	231	158	138	138
query41	66	59	58	58
query42	258	255	256	255
query43	256	242	218	218
query44	
query45	199	189	185	185
query46	879	979	609	609
query47	2135	2175	2080	2080
query48	324	329	230	230
query49	620	452	375	375
query50	675	283	211	211
query51	4108	4066	4005	4005
query52	257	262	250	250
query53	286	335	287	287
query54	298	273	284	273
query55	89	85	83	83
query56	326	325	308	308
query57	1943	1894	1865	1865
query58	284	287	267	267
query59	2826	2938	2738	2738
query60	348	364	324	324
query61	156	156	158	156
query62	627	591	540	540
query63	304	273	278	273
query64	5099	1296	1032	1032
query65	
query66	1481	458	348	348
query67	24172	24406	24199	24199
query68	
query69	398	327	295	295
query70	983	1003	969	969
query71	344	304	300	300
query72	2858	2690	2755	2690
query73	551	539	335	335
query74	9643	9561	9379	9379
query75	2864	2786	2514	2514
query76	2285	1054	669	669
query77	380	388	317	317
query78	10968	11045	10432	10432
query79	1585	764	576	576
query80	1327	621	566	566
query81	555	262	229	229
query82	1023	154	123	123
query83	326	259	244	244
query84	273	112	103	103
query85	911	503	459	459
query86	430	308	327	308
query87	3151	3080	3007	3007
query88	3597	2688	2701	2688
query89	429	369	342	342
query90	2028	183	179	179
query91	166	160	138	138
query92	74	73	70	70
query93	1008	868	492	492
query94	638	337	299	299
query95	577	334	389	334
query96	664	543	232	232
query97	2487	2510	2420	2420
query98	245	222	226	222
query99	1019	995	921	921
Total cold run time: 250869 ms
Total hot run time: 168118 ms

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.81% (19851/37591)
Line Coverage 36.31% (185412/510576)
Region Coverage 32.56% (143570/440963)
Branch Coverage 33.75% (62849/186194)

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