Skip to content

[refactor](be) Remove redundant casts from BE code#64087

Open
Mryange wants to merge 1 commit into
apache:masterfrom
Mryange:refine/remove-redundant-casts
Open

[refactor](be) Remove redundant casts from BE code#64087
Mryange wants to merge 1 commit into
apache:masterfrom
Mryange:refine/remove-redundant-casts

Conversation

@Mryange
Copy link
Copy Markdown
Contributor

@Mryange Mryange commented Jun 3, 2026

What problem does this PR solve?

Problem Summary: Remove redundant casts reported by clang-tidy readability-redundant-casting in BE code. These casts were no-op conversions to the same type, including redundant static_cast, reinterpret_cast, and C-style casts. The change keeps casts that still perform real type conversion and only removes the redundant outer casts reported by clang-tidy.

Release note

None

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

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Remove redundant casts reported by clang-tidy readability-redundant-casting in BE code. These casts were no-op conversions to the same type, including redundant static_cast, reinterpret_cast, and C-style casts. The change keeps casts that still perform real type conversion and only removes the redundant outer casts reported by clang-tidy.

### Release note

None

### Check List (For Author)

- Test: Static analysis / Build
    - Ran clang-tidy readability-redundant-casting on the modified BE files; no remaining readability-redundant-casting warnings were reported.
    - Ran clang-format-16 on modified BE files.
    - Ran git diff --check -- be/src.
    - Ran sh build.sh --be -j48, build succeeded with "Successfully build Doris".
- Behavior changed: No
- Does this need documentation: No
@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?

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jun 3, 2026

/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.

Review result: no blocking issues found.

Critical checkpoint conclusions:

  • Goal and tests: The PR is a narrow BE refactor to remove clang-tidy readability-redundant-casting findings. The changed sites accomplish that goal without observable semantic changes; the PR states clang-tidy, clang-format, diff check, and BE build were run.
  • Scope and clarity: The modification is small and focused on redundant casts only.
  • Concurrency and lifecycle: No new shared state, locks, threads, or lifecycle ownership changes were introduced.
  • Configuration and compatibility: No new configuration, protocol, storage format, or function-symbol compatibility changes were introduced.
  • Parallel code paths: The changes are mechanical across independent call sites; no functional path appears partially updated.
  • Conditional checks and error handling: No new conditional checks or error-handling paths were introduced. The removed static_cast in ColumnVariant::finalize discards a void return, not a Status.
  • Test coverage: No new functional tests are needed for this no-behavior refactor; build/static-analysis coverage is appropriate for this scope.
  • Observability, transactions, and data writes: No logging/metrics, transaction, persistence, or data-write behavior changes were introduced.
  • FE/BE variable passing: No transmitted variables or thrift/interface data paths were changed.
  • Performance: No new allocations or redundant work were introduced; the changes are neutral.

Focus points: No additional user-provided review focus was specified.

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jun 4, 2026

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 29328 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit a07e9889cadc68334607b0797ebfbeb483bfecc0, 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	17629	3989	3957	3957
q2	q3	10826	1411	847	847
q4	4686	484	349	349
q5	7560	905	589	589
q6	181	170	137	137
q7	810	836	642	642
q8	9343	1525	1594	1525
q9	5784	4566	4579	4566
q10	6750	1835	1577	1577
q11	429	269	249	249
q12	630	418	288	288
q13	18123	3356	2814	2814
q14	264	254	243	243
q15	q16	779	781	709	709
q17	927	899	952	899
q18	7180	5741	5631	5631
q19	1242	1271	1121	1121
q20	519	407	269	269
q21	6092	2800	2603	2603
q22	448	372	313	313
Total cold run time: 100202 ms
Total hot run time: 29328 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	5110	4746	4708	4708
q2	q3	4822	5298	4711	4711
q4	2166	2197	1383	1383
q5	4771	4902	4850	4850
q6	239	178	125	125
q7	1835	1732	1599	1599
q8	2452	2124	2096	2096
q9	7987	7788	7455	7455
q10	4730	4682	4250	4250
q11	526	382	352	352
q12	750	746	526	526
q13	3016	3300	2796	2796
q14	287	279	254	254
q15	q16	677	700	609	609
q17	1285	1256	1250	1250
q18	7221	6843	6925	6843
q19	1090	1108	1096	1096
q20	2241	2223	1963	1963
q21	5316	4609	4511	4511
q22	516	472	424	424
Total cold run time: 57037 ms
Total hot run time: 51801 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4342	638	496	496
query6	442	199	183	183
query7	4838	558	304	304
query8	390	224	232	224
query9	8788	4097	4083	4083
query10	486	313	274	274
query11	5889	2344	2169	2169
query12	164	106	99	99
query13	1263	582	434	434
query14	6308	5388	5095	5095
query14_1	4432	4388	4411	4388
query15	213	198	182	182
query16	1049	482	454	454
query17	1138	711	613	613
query18	2729	490	357	357
query19	211	189	154	154
query20	117	109	110	109
query21	220	144	123	123
query22	13624	13653	13365	13365
query23	17385	16569	16209	16209
query23_1	16385	16358	16381	16358
query24	7561	1808	1317	1317
query24_1	1332	1323	1338	1323
query25	581	472	421	421
query26	1325	326	172	172
query27	2672	582	343	343
query28	4423	2046	2037	2037
query29	1107	620	507	507
query30	312	239	198	198
query31	1108	1085	966	966
query32	114	66	64	64
query33	531	342	269	269
query34	1246	1142	639	639
query35	751	785	669	669
query36	1403	1403	1198	1198
query37	153	109	91	91
query38	3187	3145	3039	3039
query39	940	929	891	891
query39_1	891	875	884	875
query40	242	124	99	99
query41	65	61	61	61
query42	94	93	97	93
query43	325	324	277	277
query44	
query45	192	188	180	180
query46	1072	1170	745	745
query47	2407	2402	2244	2244
query48	406	434	298	298
query49	629	483	390	390
query50	997	347	251	251
query51	4412	4313	4273	4273
query52	88	90	77	77
query53	240	269	195	195
query54	287	234	203	203
query55	82	75	71	71
query56	236	216	225	216
query57	1435	1413	1337	1337
query58	259	212	210	210
query59	1621	1664	1503	1503
query60	281	249	236	236
query61	165	165	158	158
query62	695	662	613	613
query63	236	188	187	187
query64	2539	807	614	614
query65	
query66	1778	480	385	385
query67	29771	29705	29520	29520
query68	
query69	428	320	265	265
query70	987	983	968	968
query71	289	226	209	209
query72	3009	2681	2407	2407
query73	861	744	427	427
query74	5086	4935	4803	4803
query75	2661	2594	2239	2239
query76	2304	1145	775	775
query77	372	384	286	286
query78	12452	12510	11833	11833
query79	1444	1089	781	781
query80	1324	493	404	404
query81	510	281	237	237
query82	579	158	119	119
query83	352	276	252	252
query84	268	144	115	115
query85	925	524	440	440
query86	429	307	285	285
query87	3418	3341	3181	3181
query88	3702	2767	2757	2757
query89	434	372	330	330
query90	1871	188	180	180
query91	177	163	137	137
query92	60	65	58	58
query93	1530	1491	878	878
query94	726	355	322	322
query95	674	461	347	347
query96	1040	766	328	328
query97	2732	2710	2595	2595
query98	209	205	206	205
query99	1146	1184	1054	1054
Total cold run time: 253039 ms
Total hot run time: 169785 ms

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jun 4, 2026

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 29514 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit a07e9889cadc68334607b0797ebfbeb483bfecc0, 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	17614	4029	3992	3992
q2	q3	10810	1455	818	818
q4	4687	487	362	362
q5	7541	907	595	595
q6	184	171	137	137
q7	777	858	666	666
q8	9391	1673	1640	1640
q9	5978	4502	4519	4502
q10	6787	1821	1554	1554
q11	444	270	260	260
q12	634	420	293	293
q13	18226	3393	2811	2811
q14	266	258	238	238
q15	q16	833	790	713	713
q17	1005	920	1026	920
q18	7245	5842	5608	5608
q19	2193	1402	1070	1070
q20	521	414	267	267
q21	6713	2739	2925	2739
q22	481	391	329	329
Total cold run time: 102330 ms
Total hot run time: 29514 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	5089	4782	4776	4776
q2	q3	4880	5302	4774	4774
q4	2107	2194	1410	1410
q5	4783	4958	4767	4767
q6	232	171	126	126
q7	1851	1833	1593	1593
q8	2418	2124	2121	2121
q9	7977	7496	7462	7462
q10	4744	4673	4214	4214
q11	531	386	359	359
q12	734	739	520	520
q13	2971	3351	2745	2745
q14	275	282	268	268
q15	q16	693	712	616	616
q17	1295	1253	1263	1253
q18	7497	6940	6965	6940
q19	1127	1084	1087	1084
q20	2237	2230	1955	1955
q21	5271	4551	4419	4419
q22	519	478	409	409
Total cold run time: 57231 ms
Total hot run time: 51811 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 75.00% (39/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.97% (27530/38253)
Line Coverage 55.53% (294871/531057)
Region Coverage 52.28% (246061/470691)
Branch Coverage 53.42% (106376/199131)

@hello-stephen
Copy link
Copy Markdown
Contributor

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

query5	4328	639	501	501
query6	452	201	183	183
query7	4832	542	295	295
query8	376	226	220	220
query9	8765	4030	4057	4030
query10	456	315	262	262
query11	5699	2355	2150	2150
query12	158	108	101	101
query13	1285	580	424	424
query14	6865	5413	5113	5113
query14_1	4423	4399	4388	4388
query15	210	198	176	176
query16	1006	458	429	429
query17	1111	677	549	549
query18	2549	461	338	338
query19	214	175	141	141
query20	115	106	103	103
query21	217	142	117	117
query22	13610	13596	13389	13389
query23	17283	16461	16110	16110
query23_1	16321	16286	16349	16286
query24	7463	1758	1308	1308
query24_1	1332	1312	1319	1312
query25	540	470	381	381
query26	1151	321	159	159
query27	2681	600	346	346
query28	4482	2067	2040	2040
query29	1069	626	473	473
query30	319	238	203	203
query31	1120	1069	948	948
query32	119	61	61	61
query33	533	331	253	253
query34	1219	1145	644	644
query35	764	781	683	683
query36	1434	1435	1230	1230
query37	158	106	86	86
query38	3224	3135	3051	3051
query39	934	924	890	890
query39_1	896	875	860	860
query40	225	123	101	101
query41	67	62	62	62
query42	104	92	94	92
query43	315	318	277	277
query44	
query45	192	185	182	182
query46	1067	1215	754	754
query47	2435	2398	2251	2251
query48	394	433	280	280
query49	639	479	350	350
query50	970	350	261	261
query51	4309	4294	4179	4179
query52	92	89	77	77
query53	242	269	191	191
query54	273	237	195	195
query55	78	81	70	70
query56	240	229	211	211
query57	1448	1403	1331	1331
query58	283	218	210	210
query59	1567	1669	1458	1458
query60	281	251	235	235
query61	163	159	179	159
query62	705	679	594	594
query63	234	193	186	186
query64	2555	861	696	696
query65	
query66	1795	483	365	365
query67	29734	29632	29532	29532
query68	
query69	437	309	274	274
query70	942	972	954	954
query71	316	225	227	225
query72	3050	2643	2426	2426
query73	835	757	415	415
query74	5144	4958	4780	4780
query75	2663	2576	2281	2281
query76	2315	1126	815	815
query77	356	394	290	290
query78	12337	12401	11933	11933
query79	1305	1018	756	756
query80	548	481	394	394
query81	451	282	244	244
query82	238	155	121	121
query83	388	281	254	254
query84	269	144	114	114
query85	875	537	438	438
query86	330	319	302	302
query87	3361	3340	3156	3156
query88	3637	2748	2737	2737
query89	419	383	330	330
query90	2128	181	176	176
query91	178	163	141	141
query92	64	64	60	60
query93	1435	1418	926	926
query94	550	360	320	320
query95	671	479	348	348
query96	1096	854	334	334
query97	2691	2719	2573	2573
query98	227	209	204	204
query99	1140	1170	1045	1045
Total cold run time: 251007 ms
Total hot run time: 169153 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 75.00% (39/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.97% (27530/38253)
Line Coverage 55.53% (294871/531057)
Region Coverage 52.28% (246061/470691)
Branch Coverage 53.42% (106376/199131)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 75.00% (39/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.97% (27531/38254)
Line Coverage 55.53% (294959/531188)
Region Coverage 52.28% (246148/470840)
Branch Coverage 53.42% (106390/199163)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 75.00% (39/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.98% (27534/38254)
Line Coverage 55.54% (295003/531188)
Region Coverage 52.29% (246185/470840)
Branch Coverage 53.43% (106413/199163)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 75.00% (39/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.97% (27533/38254)
Line Coverage 55.53% (294989/531188)
Region Coverage 52.23% (245911/470840)
Branch Coverage 53.43% (106414/199163)

Copy link
Copy Markdown
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jun 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

PR approved by anyone and no changes requested.

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.

3 participants