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

liuneng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 2bb813c1c [GLUTEN-6257][CH] Mismatched headers in broadcast join #6258
2bb813c1c is described below

commit 2bb813c1c232464383276708ba58602adc5e06c0
Author: lgbo <[email protected]>
AuthorDate: Fri Jun 28 10:14:21 2024 +0800

    [GLUTEN-6257][CH] Mismatched headers in broadcast join #6258
    
    What changes were proposed in this pull request?
    (Please fill in changes proposed in this fix)
    
    Fixes: #6257
    
    How was this patch tested?
    (Please explain how this patch was tested. E.g. unit tests, integration 
tests, manual tests)
    
    unit tests
    
    (If this patch involves UI changes, please attach a screenshot; otherwise, 
remove this)
---
 cpp-ch/local-engine/Parser/JoinRelParser.cpp | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/cpp-ch/local-engine/Parser/JoinRelParser.cpp 
b/cpp-ch/local-engine/Parser/JoinRelParser.cpp
index 58b156c3c..9a3cc91ba 100644
--- a/cpp-ch/local-engine/Parser/JoinRelParser.cpp
+++ b/cpp-ch/local-engine/Parser/JoinRelParser.cpp
@@ -309,12 +309,27 @@ DB::QueryPlanPtr JoinRelParser::parseJoin(const 
substrait::JoinRel & join, DB::Q
     // Add a check to find error easily.
     if (storage_join)
     {
-        if(!blocksHaveEqualStructure(right_header_before_convert_step, 
right->getCurrentDataStream().header))
+        bool is_col_names_changed = false;
+        const auto & current_right_header = 
right->getCurrentDataStream().header;
+        if (right_header_before_convert_step.columns() != 
current_right_header.columns())
+            is_col_names_changed = true;
+        if (!is_col_names_changed)
+        {
+            for (size_t i = 0; i < right_header_before_convert_step.columns(); 
i++)
+            {
+                if (right_header_before_convert_step.getByPosition(i).name != 
current_right_header.getByPosition(i).name)
+                {
+                    is_col_names_changed = true;
+                    break;
+                }
+            }
+        }
+        if (is_col_names_changed)
         {
             throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "For broadcast 
join, we must not change the columns name in the right table.\nleft 
header:{},\nright header: {} -> {}",
-                left->getCurrentDataStream().header.dumpNames(),
-                right_header_before_convert_step.dumpNames(),
-                right->getCurrentDataStream().header.dumpNames());
+                left->getCurrentDataStream().header.dumpStructure(),
+                right_header_before_convert_step.dumpStructure(),
+                right->getCurrentDataStream().header.dumpStructure());
         }
     }
 


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

Reply via email to