Skip to content

[fix] remove useless const_cast and explain const_cast for vec (4) - #56603

Merged
zclllyybb merged 4 commits into
apache:masterfrom
wumeibanfa:remove_vec_const4
Oct 10, 2025
Merged

zclllyybb merged 4 commits into
apache:masterfrom
wumeibanfa:remove_vec_const4

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 28, 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

BE UT Coverage Report

Increment line coverage 97.67% (42/43) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.43% (17642/33648)
Line Coverage 37.64% (160228/425722)
Region Coverage 32.13% (122211/380384)
Branch Coverage 33.52% (53614/159927)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (42/42) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.17% (23376/32846)
Line Coverage 57.58% (244474/424552)
Region Coverage 52.86% (203407/384792)
Branch Coverage 54.59% (87627/160520)

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run performance

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run p0

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run performance

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (42/42) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.18% (23379/32846)
Line Coverage 57.59% (244493/424552)
Region Coverage 52.86% (203406/384792)
Branch Coverage 54.60% (87641/160520)

@doris-robot

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

query1	0.06	0.05	0.05
query2	0.10	0.05	0.06
query3	0.25	0.08	0.09
query4	1.62	0.12	0.11
query5	0.27	0.26	0.26
query6	1.15	0.66	0.66
query7	0.03	0.03	0.03
query8	0.05	0.04	0.05
query9	0.63	0.53	0.52
query10	0.57	0.60	0.58
query11	0.16	0.11	0.11
query12	0.16	0.12	0.11
query13	0.62	0.62	0.62
query14	1.02	1.04	1.03
query15	0.89	0.85	0.87
query16	0.41	0.39	0.41
query17	1.07	1.05	1.04
query18	0.22	0.20	0.21
query19	1.92	1.89	1.84
query20	0.01	0.01	0.02
query21	15.42	0.95	0.57
query22	0.76	1.19	0.74
query23	14.86	1.41	0.58
query24	7.03	2.03	0.95
query25	0.45	0.29	0.12
query26	0.49	0.15	0.14
query27	0.07	0.06	0.06
query28	10.15	1.34	0.94
query29	12.53	3.93	3.21
query30	0.27	0.13	0.12
query31	2.84	0.58	0.38
query32	3.24	0.56	0.47
query33	3.15	3.09	3.11
query34	16.21	5.51	4.90
query35	4.92	4.91	4.94
query36	0.69	0.51	0.51
query37	0.10	0.07	0.07
query38	0.07	0.05	0.05
query39	0.04	0.03	0.03
query40	0.18	0.17	0.14
query41	0.08	0.04	0.04
query42	0.04	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 104.85 s
Total hot run time: 30.67 s

Comment thread be/src/vec/columns/subcolumn_tree.h Resolved
@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot

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

query1	0.06	0.05	0.05
query2	0.09	0.05	0.06
query3	0.25	0.08	0.08
query4	1.60	0.11	0.11
query5	0.27	0.27	0.25
query6	1.19	0.65	0.64
query7	0.04	0.03	0.03
query8	0.06	0.04	0.04
query9	0.63	0.52	0.52
query10	0.58	0.57	0.57
query11	0.17	0.14	0.12
query12	0.15	0.12	0.12
query13	0.62	0.63	0.61
query14	1.02	1.04	1.03
query15	0.86	0.84	0.86
query16	0.41	0.41	0.41
query17	1.03	1.10	1.03
query18	0.21	0.21	0.20
query19	1.92	1.85	1.82
query20	0.02	0.01	0.01
query21	15.43	0.94	0.62
query22	0.75	1.16	0.80
query23	14.80	1.36	0.64
query24	7.30	2.04	0.39
query25	0.30	0.11	0.07
query26	0.57	0.16	0.14
query27	0.06	0.06	0.05
query28	9.19	1.32	0.92
query29	12.55	3.90	3.22
query30	0.29	0.13	0.13
query31	2.84	0.60	0.39
query32	3.23	0.57	0.49
query33	3.12	3.13	3.14
query34	16.16	5.48	4.87
query35	4.97	4.89	4.87
query36	0.66	0.52	0.52
query37	0.10	0.08	0.07
query38	0.07	0.04	0.05
query39	0.04	0.03	0.03
query40	0.17	0.15	0.15
query41	0.09	0.03	0.04
query42	0.04	0.03	0.02
query43	0.05	0.04	0.03
Total cold run time: 103.96 s
Total hot run time: 30.15 s

@doris-robot

Copy link
Copy Markdown

BE UT Coverage Report

Increment line coverage 96.67% (29/30) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.48% (17710/33743)
Line Coverage 37.66% (160750/426877)
Region Coverage 32.17% (122863/381907)
Branch Coverage 33.55% (53855/160529)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (29/29) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.25% (23555/33061)
Line Coverage 57.69% (246037/426446)
Region Coverage 52.98% (204884/386735)
Branch Coverage 54.68% (88217/161340)

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run p0

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run nonConcurrent

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (29/29) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.17% (23528/33061)
Line Coverage 57.61% (245671/426446)
Region Coverage 52.87% (204474/386735)
Branch Coverage 54.56% (88026/161340)

Comment thread be/src/vec/columns/subcolumn_tree.h Resolved
@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run buildall

This reverts commit 1b94623.
@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run buildall

@zclllyybb zclllyybb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@doris-robot

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

query1	0.06	0.05	0.05
query2	0.09	0.05	0.05
query3	0.26	0.09	0.08
query4	1.62	0.13	0.12
query5	0.28	0.26	0.25
query6	1.17	0.64	0.65
query7	0.04	0.03	0.02
query8	0.06	0.05	0.05
query9	0.66	0.53	0.53
query10	0.58	0.57	0.58
query11	0.17	0.11	0.12
query12	0.16	0.12	0.12
query13	0.63	0.62	0.63
query14	1.05	1.01	1.04
query15	0.88	0.83	0.89
query16	0.41	0.41	0.39
query17	1.07	1.04	1.06
query18	0.22	0.20	0.20
query19	1.89	1.79	1.86
query20	0.02	0.01	0.01
query21	15.48	0.94	0.58
query22	0.77	1.22	0.73
query23	14.83	1.38	0.66
query24	7.60	1.52	0.75
query25	0.52	0.27	0.09
query26	0.54	0.16	0.14
query27	0.07	0.04	0.05
query28	9.28	1.35	0.93
query29	12.62	3.93	3.23
query30	0.28	0.15	0.11
query31	2.83	0.58	0.39
query32	3.25	0.57	0.47
query33	3.09	3.04	3.09
query34	16.18	5.51	4.89
query35	4.98	4.86	4.96
query36	0.72	0.52	0.51
query37	0.10	0.08	0.08
query38	0.06	0.05	0.05
query39	0.04	0.03	0.02
query40	0.17	0.16	0.16
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 104.89 s
Total hot run time: 30.31 s

@doris-robot

Copy link
Copy Markdown

BE UT Coverage Report

Increment line coverage 96.67% (29/30) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.51% (17721/33747)
Line Coverage 37.68% (160871/426915)
Region Coverage 32.19% (122965/382000)
Branch Coverage 33.56% (53887/160552)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (29/29) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.20% (23541/33065)
Line Coverage 57.65% (245869/426487)
Region Coverage 52.85% (204440/386828)
Branch Coverage 54.59% (88089/161363)

@wumeibanfa

Copy link
Copy Markdown
Contributor Author

run cloud_p0

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (29/29) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.20% (23541/33065)
Line Coverage 57.65% (245869/426487)
Region Coverage 52.85% (204440/386828)
Branch Coverage 54.59% (88089/161363)

@zclllyybb
zclllyybb merged commit 67e2a40 into apache:master Oct 10, 2025
12 checks passed
morningman pushed a commit to morningman/doris that referenced this pull request Mar 18, 2026
…pache#56603)

 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*>
xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Mar 18, 2026
…pache#56603)

 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*>
xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Mar 19, 2026
…pache#56603)

 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*>
morningman pushed a commit that referenced this pull request Mar 19, 2026
) (#61474)

Replacement for #61446 because the original PR head branch could not be
updated from this environment.

This branch contains:
- [feat] add Parquet metadata TVF (#58972)
- [fix](regression) stabilize parquet_meta tvf assertions across s3
buckets (#60938)
- [fix] remove useless const_cast and explain const_cast for vec (4)
(#56603)
- [fix] fix parquet metadata TVF compile on branch-4.1

Please review this PR instead of #61446.

---------

Co-authored-by: admiring_xm <[email protected]>
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.1.0-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants