Skip to content

branch-4.1: [Fix](thirdparty) Unify arrow cpp standard with be (#64390) - #65213

Merged
yiguolei merged 1 commit into
apache:branch-4.1from
linrrzqqq:pick-64390-branch-4.1
Jul 4, 2026
Merged

branch-4.1: [Fix](thirdparty) Unify arrow cpp standard with be (#64390)#65213
yiguolei merged 1 commit into
apache:branch-4.1from
linrrzqqq:pick-64390-branch-4.1

Conversation

@linrrzqqq

Copy link
Copy Markdown
Collaborator

cherry-pick: #64390

Related PR: apache#63191
Problem Summary:
Arrow 17 defaults to `C++17` when CMAKE_CXX_STANDARD is not specified,
while Doris BE is built with `C++20`. This can make header-defined
inline/template code from Arrow Flight and its dependencies be compiled
under different C++ standard modes in the same final binary.
In particular, Arrow Status-related inline paths may generate different
implementations across C++17 and C++20, such as different initialization
strategies for function-local static std::string objects:
code:
```cpp
const std::string& get_empty_string() {
static const std::string s = "";
return s;
}
```
cpp17 lazy initialization:
```asm
get_empty_string[abi:cxx11]():
push rbp
mov rbp, rsp
sub rsp, 64
cmp byte ptr [rip + guard variable for get_empty_string[abi:cxx11]()::s[abi:cxx11]], 0
jne .LBB0_4
lea rdi, [rip + guard variable for get_empty_string[abi:cxx11]()::s[abi:cxx11]]
call __cxa_guard_acquire@PLT
cmp eax, 0
je .LBB0_4
lea rdx, [rbp - 33]
mov qword ptr [rbp - 32], rdx
mov rax, qword ptr [rbp - 32]
mov qword ptr [rbp - 8], rax
lea rdi, [rip + get_empty_string[abi:cxx11]()::s[abi:cxx11]]
lea rsi, [rip + .L.str]
call std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::basic_string<std::allocator<char>>(char const*, std::allocator<char> const&)
jmp .LBB0_3
.LBB0_3:
lea rax, [rbp - 33]
mov qword ptr [rbp - 24], rax
mov rdi, qword ptr [rbp - 24]
call std::__new_allocator<char>::~__new_allocator() [base object destructor]
lea rdi, [rip + std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::~basic_string() [base object destructor]]
lea rsi, [rip + get_empty_string[abi:cxx11]()::s[abi:cxx11]]
lea rdx, [rip + __dso_handle]
call __cxa_atexit@PLT
lea rdi, [rip + guard variable for get_empty_string[abi:cxx11]()::s[abi:cxx11]]
call __cxa_guard_release@PLT
```
cpp20 constant initialization:
```asm
get_empty_string[abi:cxx11]():
push rbp
mov rbp, rsp
lea rax, [rip + get_empty_string[abi:cxx11]()::s[abi:cxx11]]
pop rbp
ret
get_empty_string[abi:cxx11]()::s[abi:cxx11]:
.quad get_empty_string[abi:cxx11]()::s[abi:cxx11]+16
.quad 0
.zero 16
```
Mixing those definitions through `weak/COMDAT` symbols is not a
supported build model and can surface as runtime crashes in Flight
error/status handling paths.
@linrrzqqq
linrrzqqq requested a review from yiguolei as a code ownerJuly 3, 2026 23:09
@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?

@linrrzqqq

Copy link
Copy Markdown
CollaboratorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.77% (27569/37373)
Line Coverage57.43% (299112/520819)
Region Coverage55.02% (250745/455747)
Branch Coverage56.34% (108518/192629)

@yiguolei
yiguolei merged commit a281c9f into apache:branch-4.1Jul 4, 2026
29 of 33 checks passed
@linrrzqqq
linrrzqqq deleted the pick-64390-branch-4.1 branch July 4, 2026 08:08
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@linrrzqqq@hello-stephen@yiguolei