Skip to content

[fix] remove useless const_cast and explain const_cast for vec (6) - #56610

Merged
zclllyybb merged 1 commit into
apache:masterfrom
wumeibanfa:remove_vec_const6
Oct 10, 2025
Merged

zclllyybb merged 1 commit into
apache:masterfrom
wumeibanfa:remove_vec_const6

Conversation

@wumeibanfa

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

go through whole be/ and find all const_cast

Issue Number: #55057

Problem Summary:

  1. remove useless const_cast
  2. explain why using const_cast does not result in undefined behavior
  3. don't modify some const_cast
    (1) some code in DBUG_EXECUTE_IF or test file
    (2) underlying data structures, such as cow
    (3) const_cast<const T*>

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?

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot

Copy link
Copy Markdown
ClickBench: Total hot run time: 30.59 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit f06df60fce837b9b1d4ad8ebd247463c08d4ab6e, data reload: false

query1	0.05	0.05	0.05
query2	0.09	0.05	0.06
query3	0.25	0.09	0.08
query4	1.60	0.12	0.12
query5	0.27	0.26	0.25
query6	1.17	0.65	0.66
query7	0.04	0.03	0.03
query8	0.06	0.05	0.05
query9	0.60	0.57	0.51
query10	0.59	0.57	0.57
query11	0.16	0.11	0.12
query12	0.15	0.12	0.12
query13	0.62	0.64	0.61
query14	1.02	1.06	1.03
query15	0.87	0.86	0.86
query16	0.40	0.39	0.40
query17	1.05	1.11	1.07
query18	0.21	0.20	0.20
query19	1.94	1.88	1.87
query20	0.01	0.02	0.01
query21	15.42	0.94	0.57
query22	0.76	1.19	0.92
query23	14.74	1.37	0.66
query24	6.90	1.94	0.60
query25	0.49	0.28	0.09
query26	0.53	0.16	0.14
query27	0.05	0.06	0.06
query28	9.60	1.39	0.93
query29	12.62	3.90	3.22
query30	0.27	0.14	0.14
query31	2.84	0.61	0.39
query32	3.26	0.57	0.49
query33	3.16	3.18	3.09
query34	15.91	5.51	4.89
query35	4.90	4.87	4.94
query36	0.71	0.52	0.52
query37	0.10	0.07	0.07
query38	0.06	0.05	0.04
query39	0.04	0.03	0.03
query40	0.18	0.14	0.14
query41	0.09	0.04	0.03
query42	0.04	0.04	0.03
query43	0.05	0.04	0.04
Total cold run time: 103.87 s
Total hot run time: 30.59 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 47.62% (10/21) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.42% (17637/33643)
Line Coverage 37.63% (160198/425691)
Region Coverage 32.13% (122221/380363)
Branch Coverage 33.52% (53608/159915)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (13/13) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.14% (23364/32841)
Line Coverage 57.57% (244403/424524)
Region Coverage 52.96% (203784/384771)
Branch Coverage 54.62% (87663/160508)

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Oct 10, 2025
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@zclllyybb
zclllyybb merged commit 713108d into apache:master Oct 10, 2025
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.

5 participants