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

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.

2 participants