Uh oh!
There was an error while loading. Please reload this page.
[fix](be) Remove pure attribute from assert_cast - #63417
Conversation
### What problem does this PR solve? Issue Number: None Related PR: None Problem Summary: assert_cast may throw doris::Exception when release type checking detects an invalid cast. The function was annotated with PURE even though throwing an exception is an observable side effect and changes control flow. Remove the incorrect PURE annotation so compilers generate normal exception handling for assert_cast failure paths. ### Release note None ### Check List (For Author) - Test: Manual test - git diff --cached --check - Behavior changed: No - Does this need documentation: No Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
hello-stephen
commented
May 20, 2026
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes an incorrect compiler optimization contract by removing the PURE attribute from assert_cast, since assert_cast can throw doris::Exception on invalid casts (observable side effect / control-flow change), making __attribute__((pure)) semantically invalid for this function.
Changes:
- Removed the
PUREattribute annotation fromassert_castto avoid incorrect compiler assumptions/optimizations on exception paths.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BiteTheDDDDt
commented
May 20, 2026
/review |
BiteTheDDDDt
commented
May 20, 2026
run buildall |
hello-stephen
commented
May 20, 2026
TPC-H: Total hot run time: 31460 ms |
hello-stephen
commented
May 20, 2026
TPC-DS: Total hot run time: 169170 ms |
hello-stephen
commented
May 20, 2026
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Uh oh!
There was an error while loading. Please reload this page.
Problem Summary: `assert_cast` can throw `doris::Exception` when release type checking detects an invalid cast. The function was annotated with `PURE`, but throwing an exception is an observable side effect and changes control flow, so the annotation gives the compiler an invalid optimization contract for the failure path. This removes the incorrect annotation and leaves the existing cast logic unchanged.
## Summary - Pick #63417 to branch-4.1. - Pick #63969 to branch-4.1. - Do not include #62854 in this PR because branch-4.1 does not have the offset-only prerequisite infrastructure (`ACCESS_STRING_OFFSET`, `only_read_offsets`; prerequisites such as #61888/#62205 are not on branch-4.0/4.1). Direct conflict resolution would effectively backport a larger optimization stack. ## Testing - `build-support/check-format.sh` - `./run-be-ut.sh --run --filter=RuntimePredicateTest.*` - `./run-fe-ut.sh --run org.apache.doris.qe.runtime.ThriftPlansBuilderTest,org.apache.doris.qe.OldCoordinatorTest` --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
assert_castcan throwdoris::Exceptionwhen release type checking detects an invalid cast. The function was annotated withPURE, but throwing an exception is an observable side effect and changes control flow, so the annotation gives the compiler an invalid optimization contract for the failure path. This removes the incorrect annotation and leaves the existing cast logic unchanged.Release note
None
Check List (For Author)
git diff --cached --check