This is an automated email from the ASF dual-hosted git repository.

Mryange pushed a commit to branch opt_perf_4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/opt_perf_4.1 by this push:
     new 4e230074fa8 fix key pack (#65596)
4e230074fa8 is described below

commit 4e230074fa85e6b62e1ed2d74b8b52372013942e
Author: Mryange <[email protected]>
AuthorDate: Tue Jul 14 18:43:13 2026 +0800

    fix key pack (#65596)
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] 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 <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/exec/common/hash_table/hash_map_context.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/be/src/exec/common/hash_table/hash_map_context.h 
b/be/src/exec/common/hash_table/hash_map_context.h
index 121008cd830..49f3050dc9b 100644
--- a/be/src/exec/common/hash_table/hash_map_context.h
+++ b/be/src/exec/common/hash_table/hash_map_context.h
@@ -943,17 +943,21 @@ struct MethodKeysFixed : public MethodBase<TData> {
         }
 
         for (size_t j = 0; j < key_columns.size(); ++j) {
-            const char* __restrict data = key_columns[j]->get_raw_data().data;
-
             auto goo = [&]<typename Fixed, bool aligned>(Fixed zero) {
                 CHECK_EQ(sizeof(Fixed), key_sizes[j]);
                 if (has_null_column.size() && has_null_column[j]) {
                     const auto* nullmap =
                             assert_cast<const 
ColumnUInt8&>(*nullmap_columns[j]).get_data().data();
                     // make sure null cell is filled by 0x0
+                    // This mutates the same underlying buffer returned by 
get_raw_data(), so get
+                    // the restricted data pointer only after the replacement 
finishes.
                     
const_cast<IColumn*>(key_columns[j])->replace_column_null_data(nullmap);
                 }
                 auto* __restrict current = result_data + offset;
+                // Do not hoist data out of goo. A reference capture is 
lowered to an ordinary
+                // closure field, so restrict/noalias information is lost when 
goo is not inlined,
+                // which prevents the copy loop from being optimized.
+                const char* __restrict data = 
key_columns[j]->get_raw_data().data;
                 for (size_t i = 0; i < row_numbers; ++i) {
                     memcpy_fixed<Fixed, aligned>(current, data);
                     current += sizeof(T);
@@ -965,6 +969,7 @@ struct MethodKeysFixed : public MethodBase<TData> {
                 // Also verify that the stride sizeof(T) is a multiple of 
alignof(Fixed),
                 // otherwise alignment will be lost on subsequent loop 
iterations
                 // (e.g. UInt96 has sizeof=12, stride 12 is not a multiple of 
alignof(uint64_t)=8).
+                const char* data = key_columns[j]->get_raw_data().data;
                 if (sizeof(T) % alignof(Fixed) == 0 &&
                     reinterpret_cast<uintptr_t>(result_data + offset) % 
alignof(Fixed) == 0 &&
                     reinterpret_cast<uintptr_t>(data) % alignof(Fixed) == 0) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to