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

yiguolei pushed a commit to branch dev-1.1.2
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/dev-1.1.2 by this push:
     new 964fc7c21f [opt](join) speed up large data join (#11773)
964fc7c21f is described below

commit 964fc7c21f3e046cc286131d0ace7693e97085dc
Author: HappenLee <happen...@hotmail.com>
AuthorDate: Fri Aug 26 17:44:31 2022 +0800

    [opt](join) speed up large data join (#11773)
    
    Co-authored-by: lihaopeng <lihaop...@baidu.com>
---
 be/src/vec/exec/join/vhash_join_node.cpp | 62 ++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 26 deletions(-)

diff --git a/be/src/vec/exec/join/vhash_join_node.cpp 
b/be/src/vec/exec/join/vhash_join_node.cpp
index 98ffa85654..0e716c08b8 100644
--- a/be/src/vec/exec/join/vhash_join_node.cpp
+++ b/be/src/vec/exec/join/vhash_join_node.cpp
@@ -192,12 +192,7 @@ struct ProcessHashTableProbe {
             if (_build_blocks.size() == 1) {
                 for (int i = 0; i < column_length; i++) {
                     if (output_slot_flags[i]) {
-                        auto column = 
_build_blocks[0].get_by_position(i).column;
-                        if (mcol[i + column_offset]->is_nullable() xor 
column->is_nullable()) {
-                            DCHECK(mcol[i + column_offset]->is_nullable() &&
-                                   !column->is_nullable());
-                            column = make_nullable(column);
-                        }
+                        auto& column = 
_build_blocks[0].get_by_position(i).column;
                         mcol[i + column_offset]->insert_indices_from(
                                 *column, _build_block_rows.data(), 
_build_block_rows.data() + size);
                     } else {
@@ -205,6 +200,15 @@ struct ProcessHashTableProbe {
                     }
                 }
             } else {
+                bool need_nullable_convert[column_length];
+                for (int i = 0; i < column_length; ++i) {
+                    if (output_slot_flags[i]) {
+                        need_nullable_convert[i] =
+                                probe_all &&
+                                
!_build_blocks[0].get_by_position(i).column->is_nullable();
+                    }
+                }
+
                 for (int i = 0; i < column_length; i++) {
                     if (output_slot_flags[i]) {
                         for (int j = 0; j < size; j++) {
@@ -214,17 +218,20 @@ struct ProcessHashTableProbe {
                                     assert_cast<ColumnNullable*>(mcol[i + 
column_offset].get())
                                             ->insert_join_null_data();
                                 } else {
-                                    auto column = 
_build_blocks[_build_block_offsets[j]]
-                                                          .get_by_position(i)
-                                                          .column;
-                                    if (mcol[i + column_offset]->is_nullable() 
xor
-                                        column->is_nullable()) {
-                                        DCHECK(mcol[i + 
column_offset]->is_nullable() &&
-                                               !column->is_nullable());
-                                        column = make_nullable(column);
+                                    auto& column = 
_build_blocks[_build_block_offsets[j]]
+                                                           .get_by_position(i)
+                                                           .column;
+                                    if (need_nullable_convert[i]) {
+                                        assert_cast<ColumnNullable*>(mcol[i + 
column_offset].get())
+                                                ->get_null_map_data()
+                                                .push_back(0);
+                                        assert_cast<ColumnNullable*>(mcol[i + 
column_offset].get())
+                                                ->get_nested_column()
+                                                .insert_from(*column, 
_build_block_rows[j]);
+                                    } else {
+                                        mcol[i + 
column_offset]->insert_from(*column,
+                                                                             
_build_block_rows[j]);
                                     }
-                                    mcol[i + 
column_offset]->insert_from(*column,
-                                                                         
_build_block_rows[j]);
                                 }
                             } else {
                                 if (_build_block_offsets[j] == -1) {
@@ -236,17 +243,20 @@ struct ProcessHashTableProbe {
                                     // just insert default value
                                     mcol[i + column_offset]->insert_default();
                                 } else {
-                                    auto column = 
_build_blocks[_build_block_offsets[j]]
-                                                          .get_by_position(i)
-                                                          .column;
-                                    if (mcol[i + column_offset]->is_nullable() 
xor
-                                        column->is_nullable()) {
-                                        DCHECK(mcol[i + 
column_offset]->is_nullable() &&
-                                               !column->is_nullable());
-                                        column = make_nullable(column);
+                                    auto& column = 
_build_blocks[_build_block_offsets[j]]
+                                                           .get_by_position(i)
+                                                           .column;
+                                    if (need_nullable_convert[i]) {
+                                        assert_cast<ColumnNullable*>(mcol[i + 
column_offset].get())
+                                                ->get_null_map_data()
+                                                .push_back(0);
+                                        assert_cast<ColumnNullable*>(mcol[i + 
column_offset].get())
+                                                ->get_nested_column()
+                                                .insert_from(*column, 
_build_block_rows[j]);
+                                    } else {
+                                        mcol[i + 
column_offset]->insert_from(*column,
+                                                                             
_build_block_rows[j]);
                                     }
-                                    mcol[i + 
column_offset]->insert_from(*column,
-                                                                         
_build_block_rows[j]);
                                 }
                             }
                         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to