Skip to content

[fix] remove useless const_cast and explain const_cast for vec (1) - #56587

Merged
BiteTheDDDDt merged 1 commit into
apache:masterfrom
wumeibanfa:remove_vec_const
Sep 30, 2025
Merged

BiteTheDDDDt merged 1 commit into
apache:masterfrom
wumeibanfa:remove_vec_const

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

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 21.74% (5/23) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.42% (17637/33643)
Line Coverage 37.64% (160202/425662)
Region Coverage 32.12% (122178/380345)
Branch Coverage 33.52% (53596/159889)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 82.61% (19/23) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.15% (23366/32841)
Line Coverage 57.56% (244325/424492)
Region Coverage 52.80% (203159/384753)
Branch Coverage 54.56% (87559/160482)

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run performance

1 similar comment
@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run performance

@doris-robot

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

query1	0.06	0.05	0.05
query2	0.09	0.05	0.06
query3	0.25	0.09	0.09
query4	1.63	0.11	0.12
query5	0.27	0.27	0.26
query6	1.18	0.65	0.64
query7	0.04	0.03	0.03
query8	0.05	0.04	0.04
query9	0.62	0.54	0.52
query10	0.58	0.57	0.59
query11	0.19	0.11	0.11
query12	0.15	0.12	0.12
query13	0.62	0.62	0.62
query14	1.05	1.04	1.02
query15	0.86	0.83	0.86
query16	0.41	0.40	0.39
query17	1.05	1.06	1.05
query18	0.21	0.19	0.20
query19	1.92	1.81	1.84
query20	0.02	0.01	0.01
query21	15.44	0.94	0.56
query22	0.74	1.17	0.94
query23	14.72	1.38	0.63
query24	6.47	1.52	0.34
query25	0.39	0.13	0.08
query26	0.62	0.16	0.13
query27	0.06	0.05	0.05
query28	9.64	1.38	0.92
query29	12.58	3.90	3.22
query30	0.30	0.14	0.11
query31	2.83	0.58	0.38
query32	3.25	0.56	0.49
query33	3.16	3.07	3.12
query34	16.09	5.36	4.85
query35	4.91	4.95	4.92
query36	0.69	0.52	0.51
query37	0.10	0.08	0.07
query38	0.07	0.05	0.04
query39	0.03	0.02	0.03
query40	0.17	0.16	0.15
query41	0.09	0.03	0.04
query42	0.04	0.04	0.03
query43	0.04	0.04	0.03
Total cold run time: 103.68 s
Total hot run time: 30.08 s

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

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@BiteTheDDDDt
BiteTheDDDDt merged commit 0ea052c into apache:master Sep 30, 2025
github-actions Bot pushed a commit that referenced this pull request Sep 30, 2025
…56587)

 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*>
yiguolei pushed a commit that referenced this pull request Sep 30, 2025
dwdwqfwe pushed a commit to dwdwqfwe/doris that referenced this pull request Oct 4, 2025
…pache#56587)

 go through whole be/ and find all const_cast

Issue Number: apache#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*>
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. dev/4.0.0-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants