Skip to content

[fix] remove useless const_cast and explain const_cast for vec (5) - #56609

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

zclllyybb merged 1 commit into
apache:masterfrom
wumeibanfa:remove_vec_const5

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

@Thearas

Thearas commented Sep 29, 2025

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.51 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 4558b61a56f01ed78c42be74216a14f24ec24152, data reload: false

query1	0.05	0.05	0.04
query2	0.09	0.06	0.06
query3	0.25	0.08	0.08
query4	1.61	0.12	0.11
query5	0.27	0.26	0.25
query6	1.19	0.66	0.65
query7	0.03	0.03	0.03
query8	0.06	0.05	0.05
query9	0.62	0.54	0.53
query10	0.61	0.57	0.57
query11	0.17	0.11	0.12
query12	0.15	0.12	0.12
query13	0.63	0.62	0.62
query14	1.02	1.05	1.04
query15	0.88	0.88	0.87
query16	0.41	0.40	0.39
query17	1.03	1.07	1.06
query18	0.22	0.19	0.20
query19	2.00	1.82	1.83
query20	0.02	0.02	0.02
query21	15.41	0.99	0.58
query22	0.76	1.26	0.64
query23	14.92	1.38	0.63
query24	6.98	0.90	0.71
query25	0.45	0.24	0.07
query26	0.55	0.16	0.13
query27	0.06	0.05	0.06
query28	9.27	1.46	0.93
query29	12.53	4.04	3.36
query30	0.27	0.13	0.14
query31	2.83	0.62	0.39
query32	3.24	0.56	0.47
query33	3.16	3.09	3.18
query34	16.02	5.48	4.90
query35	4.95	4.94	5.00
query36	0.69	0.53	0.49
query37	0.11	0.08	0.08
query38	0.07	0.04	0.04
query39	0.04	0.03	0.04
query40	0.18	0.16	0.14
query41	0.09	0.03	0.04
query42	0.04	0.04	0.03
query43	0.04	0.04	0.04
Total cold run time: 103.97 s
Total hot run time: 30.51 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 69.70% (23/33) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.43% (17638/33643)
Line Coverage 37.64% (160216/425694)
Region Coverage 32.14% (122231/380363)
Branch Coverage 33.53% (53613/159915)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 84.85% (28/33) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.23% (23394/32841)
Line Coverage 57.69% (244891/424524)
Region Coverage 53.07% (204206/384771)
Branch Coverage 54.76% (87896/160508)

@zclllyybb
zclllyybb requested a review from mrhhsg October 10, 2025 03:09

@eldenmoon eldenmoon left a comment

Copy link
Copy Markdown
Member

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 Oct 10, 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.

@mrhhsg mrhhsg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@zclllyybb
zclllyybb merged commit bbd7d55 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.

7 participants