GH-49586: [C++][CI] StructToStructSubset test failure with libc++ 22.1.1#49682
GH-49586: [C++][CI] StructToStructSubset test failure with libc++ 22.1.1#49682kou merged 1 commit intoapache:mainfrom
Conversation
|
|
zanmato1984
left a comment
There was a problem hiding this comment.
+1
Thanks for fixing this!
|
Thanks for the fix. Switching from LGTM. |
There was a problem hiding this comment.
Pull request overview
Fixes a libc++ 22.1.1 behavioral difference causing StructToStructSubset failures by making selection of duplicate struct field names deterministic when mapping input struct fields to output struct fields.
Changes:
- Replace
std::multimap::extract(key)withlower_bound(key)+erase(it)to reliably pick the first matching entry for duplicate keys. - Update inline comments to document why
lower_boundis required for deterministic behavior across standard library implementations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 35fb62e. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them. |
…1.1 (#49682) ### Rationale for this change Fixes #49586 `std::multimap::extract(key)` does not guarantee returning the first element when there are duplicate keys. ### What changes are included in this PR? Replace extract(key) with lower_bound(key) plus erase(iterator). `lower_bound` guarantees first matching element, then read `it->second` and then `erase` the node (`extract` is not needed as the node isn't reused here). ### Are these changes tested? Yes, CI jobs are passing. ### Are there any user-facing changes? No. * GitHub Issue: #49586 Authored-by: Tadeja Kadunc <tadeja.kadunc@gmail.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Rationale for this change
Fixes #49586
std::multimap::extract(key)does not guarantee returning the first element when there are duplicate keys.What changes are included in this PR?
Replace extract(key) with lower_bound(key) plus erase(iterator).
lower_boundguarantees first matching element, then readit->secondand thenerasethe node (extractis not needed as the node isn't reused here).Are these changes tested?
Yes, CI jobs are passing.
Are there any user-facing changes?
No.