Skip to content

[env](compiler)Optimize the compilation time of cast.#61276

Open
Mryange wants to merge 4 commits intoapache:masterfrom
Mryange:env-compiler-cast
Open

[env](compiler)Optimize the compilation time of cast.#61276
Mryange wants to merge 4 commits intoapache:masterfrom
Mryange:env-compiler-cast

Conversation

@Mryange
Copy link
Contributor

@Mryange Mryange commented Mar 12, 2026

What problem does this PR solve?

Previously, many cast instantiations were done in .h files, which caused a lot of code to be instantiated whenever other files included them. Here we move those instantiations into .cpp files, and keep only the code for casting a single value in the .h file.

Release note

None

Check List (For Author)

  • Test

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

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

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

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

@hello-stephen
Copy link
Contributor

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

Please clearly describe your PR:

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

@Mryange
Copy link
Contributor Author

Mryange commented Mar 12, 2026

run buildall

1 similar comment
@Mryange
Copy link
Contributor Author

Mryange commented Mar 12, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
============================================
q1	17686	4498	4337	4337
q2	q3	10638	817	522	522
q4	4723	356	253	253
q5	7889	1215	1025	1025
q6	229	175	147	147
q7	827	853	698	698
q8	10447	1504	1369	1369
q9	4951	4781	4782	4781
q10	6303	1926	1649	1649
q11	469	256	241	241
q12	742	564	480	480
q13	18041	3001	2215	2215
q14	236	222	211	211
q15	954	802	795	795
q16	766	738	714	714
q17	724	896	398	398
q18	6075	5372	5281	5281
q19	1137	1018	604	604
q20	515	501	391	391
q21	4694	2073	1606	1606
q22	406	348	267	267
Total cold run time: 98452 ms
Total hot run time: 27984 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4663	4640	4707	4640
q2	q3	3918	4357	3839	3839
q4	884	1193	806	806
q5	4067	4397	4440	4397
q6	190	188	143	143
q7	1782	1686	1593	1593
q8	2525	2732	2619	2619
q9	7547	7611	7354	7354
q10	3838	4151	3571	3571
q11	519	436	420	420
q12	495	582	514	514
q13	2848	3150	2299	2299
q14	283	301	306	301
q15	933	844	863	844
q16	737	762	789	762
q17	1211	1457	1367	1367
q18	7252	6740	6635	6635
q19	879	853	915	853
q20	2053	2147	2023	2023
q21	3972	3574	3317	3317
q22	500	438	382	382
Total cold run time: 51096 ms
Total hot run time: 48679 ms

@doris-robot
Copy link

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

query5	4333	648	536	536
query6	330	230	218	218
query7	4226	458	271	271
query8	342	254	249	249
query9	8734	2766	2765	2765
query10	522	395	344	344
query11	7429	5801	5644	5644
query12	184	134	127	127
query13	1278	467	351	351
query14	5716	3912	3631	3631
query14_1	2802	2827	2807	2807
query15	211	193	174	174
query16	1012	482	469	469
query17	1119	721	636	636
query18	2464	452	353	353
query19	219	219	191	191
query20	137	131	132	131
query21	222	143	123	123
query22	4834	4952	4836	4836
query23	17067	15948	15856	15856
query23_1	16455	15875	15906	15875
query24	7502	1666	1281	1281
query24_1	1270	1255	1290	1255
query25	590	651	438	438
query26	1718	280	155	155
query27	2828	504	288	288
query28	4458	1887	1846	1846
query29	845	562	473	473
query30	310	246	211	211
query31	1341	1304	1234	1234
query32	80	75	75	75
query33	499	326	274	274
query34	911	941	569	569
query35	655	698	611	611
query36	1101	1117	964	964
query37	125	94	88	88
query38	2937	2950	2907	2907
query39	876	871	838	838
query39_1	840	834	846	834
query40	228	157	142	142
query41	62	59	57	57
query42	304	312	306	306
query43	233	249	218	218
query44	
query45	196	186	181	181
query46	872	981	622	622
query47	2084	2151	2061	2061
query48	334	316	233	233
query49	636	479	376	376
query50	677	275	221	221
query51	4144	4085	4089	4085
query52	291	293	290	290
query53	297	335	287	287
query54	297	269	266	266
query55	93	87	88	87
query56	326	350	308	308
query57	1360	1346	1284	1284
query58	289	284	284	284
query59	1422	1411	1271	1271
query60	354	363	322	322
query61	167	147	148	147
query62	611	598	523	523
query63	307	277	277	277
query64	5117	1278	1003	1003
query65	
query66	1462	459	355	355
query67	16445	16569	16289	16289
query68	
query69	391	311	285	285
query70	989	964	923	923
query71	338	315	307	307
query72	2813	2645	2388	2388
query73	531	589	332	332
query74	9931	9916	9766	9766
query75	2854	2779	2457	2457
query76	2268	1047	693	693
query77	370	416	322	322
query78	11090	11231	10661	10661
query79	3137	769	609	609
query80	1744	655	579	579
query81	606	294	254	254
query82	984	152	122	122
query83	336	277	252	252
query84	261	122	104	104
query85	988	566	502	502
query86	498	312	304	304
query87	3152	3106	3024	3024
query88	3557	2663	2649	2649
query89	415	361	339	339
query90	2106	185	181	181
query91	167	168	131	131
query92	92	74	72	72
query93	1993	843	491	491
query94	659	314	280	280
query95	577	403	312	312
query96	632	512	231	231
query97	2484	2478	2391	2391
query98	234	219	220	219
query99	1016	993	908	908
Total cold run time: 238924 ms
Total hot run time: 153607 ms

@Mryange Mryange force-pushed the env-compiler-cast branch from e5b432c to 8a725b2 Compare March 21, 2026 02:01
@Mryange
Copy link
Contributor Author

Mryange commented Mar 21, 2026

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 27246 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 3a339bd71eabc6db5bec3b6f02d9f5dab9be39f6, 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	17632	4496	4321	4321
q2	q3	10650	825	532	532
q4	4680	370	254	254
q5	7548	1237	1053	1053
q6	183	177	146	146
q7	804	875	701	701
q8	9295	1478	1333	1333
q9	4985	5028	4774	4774
q10	6259	1957	1663	1663
q11	476	254	240	240
q12	746	596	463	463
q13	18050	2929	2196	2196
q14	239	237	210	210
q15	q16	771	739	674	674
q17	735	892	421	421
q18	6040	5385	5297	5297
q19	1209	995	601	601
q20	544	502	390	390
q21	4715	1881	1663	1663
q22	564	510	314	314
Total cold run time: 96125 ms
Total hot run time: 27246 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	4434	4407	4443	4407
q2	q3	3863	4417	3797	3797
q4	856	1182	755	755
q5	4057	4358	4331	4331
q6	184	168	136	136
q7	1747	1633	1502	1502
q8	2466	2690	2546	2546
q9	7394	7129	7139	7129
q10	3722	4050	3525	3525
q11	489	426	412	412
q12	477	602	450	450
q13	2566	2970	2195	2195
q14	274	283	260	260
q15	q16	694	744	682	682
q17	1106	1225	1294	1225
q18	7001	6637	6673	6637
q19	874	863	868	863
q20	2004	2083	1937	1937
q21	3910	3468	3314	3314
q22	468	428	368	368
Total cold run time: 48586 ms
Total hot run time: 46471 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 137735 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 3a339bd71eabc6db5bec3b6f02d9f5dab9be39f6, data reload: false

query5	4347	630	511	511
query6	338	227	212	212
query7	4213	478	271	271
query8	368	288	242	242
query9	8727	2709	2707	2707
query10	538	418	333	333
query11	7014	5107	4909	4909
query12	195	133	127	127
query13	1271	492	355	355
query14	5733	3725	3483	3483
query14_1	2830	2859	2828	2828
query15	214	201	179	179
query16	1015	489	459	459
query17	
query18	3287	459	364	364
query19	199	215	192	192
query20	141	129	125	125
query21	
query22	13311	14093	13242	13242
query23	15961	15565	15377	15377
query23_1	15499	15381	15398	15381
query24	8091	1598	1254	1254
query24_1	1205	1262	1304	1262
query25	597	486	450	450
query26	1265	274	161	161
query27	2746	498	307	307
query28	4533	1859	1849	1849
query29	935	590	516	516
query30	307	243	196	196
query31	1049	952	870	870
query32	87	72	72	72
query33	525	360	286	286
query34	
query35	657	701	601	601
query36	1109	1167	1001	1001
query37	117	91	89	89
query38	2978	2963	2907	2907
query39	
query39_1	
query40	234	159	139	139
query41	66	62	61	61
query42	269	259	256	256
query43	256	266	232	232
query44	
query45	199	196	184	184
query46	910	981	616	616
query47	2118	2158	2062	2062
query48	302	337	254	254
query49	638	466	386	386
query50	702	283	215	215
query51	4135	4170	4037	4037
query52	266	269	259	259
query53	295	329	278	278
query54	
query55	120	86	83	83
query56	316	318	313	313
query57	1920	1709	1645	1645
query58	284	273	270	270
query59	
query60	348	355	323	323
query61	155	159	181	159
query62	645	589	558	558
query63	351	289	273	273
query64	5067	1283	987	987
query65	
query66	1467	453	359	359
query67	24461	24599	24189	24189
query68	
query69	409	309	290	290
query70	998	972	975	972
query71	337	309	307	307
query72	2844	2796	2447	2447
query73	
query74	
query75	
query76	3047	1065	682	682
query77	362	415	308	308
query78	
query79	1375	871	587	587
query80	699	655	558	558
query81	470	270	234	234
query82	1382	151	116	116
query83	
query84	252	125	107	107
query85	1040	499	455	455
query86	359	319	333	319
query87	3098	3141	2953	2953
query88	3580	2665	2650	2650
query89	434	387	340	340
query90	1932	189	184	184
query91	177	168	140	140
query92	79	75	73	73
query93	
query94	491	319	259	259
query95	627	351	394	351
query96	463	340	227	227
query97	2512	2679	2423	2423
query98	233	226	217	217
query99	1000	978	912	912
Total cold run time: 213610 ms
Total hot run time: 137735 ms

@Mryange
Copy link
Contributor Author

Mryange commented Mar 21, 2026

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 27166 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 80cba8e9067d828cc4a0feda0be019b1c15bb7af, 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	17602	4443	4284	4284
q2	q3	10645	811	523	523
q4	4680	363	250	250
q5	7564	1221	1025	1025
q6	175	174	147	147
q7	781	854	666	666
q8	9312	1491	1375	1375
q9	5044	4748	4745	4745
q10	6309	1938	1674	1674
q11	473	262	260	260
q12	745	585	472	472
q13	18038	2933	2180	2180
q14	233	233	210	210
q15	q16	740	745	684	684
q17	752	881	428	428
q18	6013	5429	5304	5304
q19	1692	976	620	620
q20	549	503	384	384
q21	4774	1838	1647	1647
q22	439	346	288	288
Total cold run time: 96560 ms
Total hot run time: 27166 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	4702	4634	4580	4580
q2	q3	3863	4404	3857	3857
q4	870	1200	760	760
q5	4084	4380	4401	4380
q6	188	182	143	143
q7	1791	1680	1541	1541
q8	2505	2702	2575	2575
q9	7943	7106	7442	7106
q10	3753	3940	3625	3625
q11	508	438	412	412
q12	486	594	456	456
q13	2675	3250	2333	2333
q14	275	301	299	299
q15	q16	773	801	749	749
q17	1149	1607	1357	1357
q18	7142	6791	6637	6637
q19	932	1043	992	992
q20	2098	2275	2034	2034
q21	4055	3482	3341	3341
q22	498	454	386	386
Total cold run time: 50290 ms
Total hot run time: 47563 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 168997 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 80cba8e9067d828cc4a0feda0be019b1c15bb7af, data reload: false

query5	4362	686	522	522
query6	348	247	231	231
query7	4221	493	273	273
query8	345	254	238	238
query9	8745	2769	2753	2753
query10	530	412	342	342
query11	6995	5120	4873	4873
query12	184	135	128	128
query13	1285	476	366	366
query14	5798	3901	3546	3546
query14_1	2919	2903	2839	2839
query15	209	198	176	176
query16	994	499	480	480
query17	921	745	641	641
query18	2453	465	366	366
query19	224	215	198	198
query20	137	128	131	128
query21	223	140	114	114
query22	13310	14037	14829	14037
query23	16275	15962	15763	15763
query23_1	15744	15720	15261	15261
query24	7227	1617	1196	1196
query24_1	1240	1257	1294	1257
query25	560	477	409	409
query26	1242	274	152	152
query27	2751	491	299	299
query28	4453	1855	1851	1851
query29	846	573	470	470
query30	300	218	187	187
query31	1007	958	893	893
query32	86	75	71	71
query33	512	344	293	293
query34	897	874	514	514
query35	629	679	636	636
query36	1109	1091	973	973
query37	138	100	87	87
query38	2965	2866	2898	2866
query39	866	834	817	817
query39_1	819	804	785	785
query40	228	152	137	137
query41	64	98	58	58
query42	263	264	260	260
query43	244	257	228	228
query44	
query45	197	196	184	184
query46	889	980	615	615
query47	2103	2151	2033	2033
query48	315	325	236	236
query49	628	466	389	389
query50	714	288	214	214
query51	4067	4040	4171	4040
query52	265	272	259	259
query53	292	339	284	284
query54	299	274	296	274
query55	89	92	87	87
query56	320	329	314	314
query57	1920	1837	1798	1798
query58	292	283	280	280
query59	2833	2962	2774	2774
query60	341	352	325	325
query61	156	160	149	149
query62	646	601	548	548
query63	314	286	278	278
query64	5109	1318	1022	1022
query65	
query66	1461	456	352	352
query67	24228	24338	24401	24338
query68	
query69	412	306	296	296
query70	1002	968	968	968
query71	355	324	310	310
query72	2701	2750	2433	2433
query73	538	555	314	314
query74	9639	9619	9432	9432
query75	2836	2782	2458	2458
query76	2299	1044	704	704
query77	367	394	312	312
query78	10951	11117	10466	10466
query79	1104	797	574	574
query80	1301	615	544	544
query81	546	262	236	236
query82	1344	153	125	125
query83	347	259	248	248
query84	301	122	95	95
query85	937	502	462	462
query86	394	309	297	297
query87	3210	3116	3048	3048
query88	3520	2651	2658	2651
query89	420	374	342	342
query90	1953	184	181	181
query91	176	166	143	143
query92	81	78	75	75
query93	911	848	506	506
query94	540	330	300	300
query95	594	404	317	317
query96	656	513	229	229
query97	2486	2508	2346	2346
query98	237	223	224	223
query99	1037	1004	951	951
Total cold run time: 248921 ms
Total hot run time: 168997 ms

@Mryange
Copy link
Contributor Author

Mryange commented Mar 21, 2026

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 26723 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 8b35babe253382d5e1a7182c66c69f72fcd82965, 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	17635	4527	4321	4321
q2	q3	10651	767	517	517
q4	4670	356	252	252
q5	7555	1188	1028	1028
q6	176	170	142	142
q7	778	832	664	664
q8	9565	1457	1316	1316
q9	4944	4713	4673	4673
q10	6360	1912	1660	1660
q11	497	263	249	249
q12	774	582	468	468
q13	18050	2970	2166	2166
q14	225	229	223	223
q15	q16	736	726	677	677
q17	759	834	435	435
q18	5928	5325	5221	5221
q19	1189	978	635	635
q20	548	491	376	376
q21	4590	1816	1385	1385
q22	476	429	315	315
Total cold run time: 96106 ms
Total hot run time: 26723 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	4742	4650	4642	4642
q2	q3	4126	4365	3863	3863
q4	869	1222	784	784
q5	4055	4491	4383	4383
q6	202	185	159	159
q7	1780	1664	1514	1514
q8	2444	2739	2548	2548
q9	7651	7556	7436	7436
q10	3786	3955	3611	3611
q11	502	434	420	420
q12	487	601	499	499
q13	3159	3191	2341	2341
q14	283	305	284	284
q15	q16	773	780	710	710
q17	1147	1364	1325	1325
q18	7276	6834	6642	6642
q19	930	957	889	889
q20	2098	2127	2055	2055
q21	3964	3525	3317	3317
q22	457	431	391	391
Total cold run time: 50731 ms
Total hot run time: 47813 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 168093 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 8b35babe253382d5e1a7182c66c69f72fcd82965, data reload: false

query5	4349	650	507	507
query6	352	243	217	217
query7	4228	462	267	267
query8	372	258	239	239
query9	8764	2767	2759	2759
query10	529	402	350	350
query11	6959	5071	4902	4902
query12	193	139	131	131
query13	1294	478	359	359
query14	5608	3751	3477	3477
query14_1	2848	2830	2852	2830
query15	204	190	181	181
query16	973	436	446	436
query17	1134	725	623	623
query18	2452	460	361	361
query19	221	215	185	185
query20	130	125	131	125
query21	219	138	115	115
query22	13175	13722	14766	13722
query23	16166	15931	15576	15576
query23_1	15838	15625	15513	15513
query24	7523	1636	1284	1284
query24_1	1252	1256	1282	1256
query25	612	478	426	426
query26	1239	263	148	148
query27	2752	475	297	297
query28	4468	1838	1858	1838
query29	808	550	477	477
query30	295	230	189	189
query31	1002	950	866	866
query32	80	72	68	68
query33	517	325	282	282
query34	896	859	540	540
query35	640	686	609	609
query36	1050	1143	930	930
query37	133	94	118	94
query38	2943	2957	2900	2900
query39	861	830	806	806
query39_1	790	781	806	781
query40	227	157	134	134
query41	64	60	58	58
query42	256	259	253	253
query43	239	255	222	222
query44	
query45	198	195	184	184
query46	881	986	616	616
query47	2101	2137	2028	2028
query48	312	318	225	225
query49	628	461	381	381
query50	681	279	216	216
query51	4060	4036	3994	3994
query52	267	265	255	255
query53	300	332	289	289
query54	304	276	262	262
query55	92	95	87	87
query56	314	314	309	309
query57	1922	1802	1673	1673
query58	284	271	263	263
query59	2808	2940	2756	2756
query60	346	338	323	323
query61	156	153	159	153
query62	629	584	529	529
query63	310	280	279	279
query64	4989	1276	1002	1002
query65	
query66	1461	445	347	347
query67	24231	24290	24133	24133
query68	
query69	405	318	292	292
query70	919	975	979	975
query71	343	298	302	298
query72	2825	2732	2492	2492
query73	534	550	327	327
query74	9624	9559	9390	9390
query75	2846	2744	2504	2504
query76	2291	1038	685	685
query77	355	382	304	304
query78	10921	11106	10474	10474
query79	2487	785	583	583
query80	1803	616	538	538
query81	540	254	222	222
query82	991	149	116	116
query83	332	268	244	244
query84	251	116	96	96
query85	907	493	449	449
query86	408	307	296	296
query87	3132	3093	3042	3042
query88	3587	2670	2653	2653
query89	418	381	349	349
query90	2049	184	181	181
query91	174	169	138	138
query92	80	70	72	70
query93	1052	836	493	493
query94	644	310	293	293
query95	607	351	340	340
query96	651	529	228	228
query97	2418	2494	2381	2381
query98	233	227	220	220
query99	1026	980	924	924
Total cold run time: 250605 ms
Total hot run time: 168093 ms

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.80% (19851/37600)
Line Coverage 36.27% (185212/510683)
Region Coverage 32.54% (143509/441010)
Branch Coverage 33.74% (62842/186258)

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