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

panxiaolei pushed a commit to branch new_join2
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 8b487c0734dacedaec6935d20dbc1b0049d23a1f
Author: BiteTheDDDDt <pxl...@qq.com>
AuthorDate: Thu Nov 23 18:06:04 2023 +0800

    fix
---
 be/src/pipeline/exec/hashjoin_build_sink.cpp    | 19 +++++++++----------
 be/src/pipeline/exec/hashjoin_probe_operator.h  |  2 +-
 be/src/vec/exec/join/process_hash_table_probe.h |  2 +-
 be/src/vec/exec/join/vhash_join_node.h          |  2 +-
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/be/src/pipeline/exec/hashjoin_build_sink.cpp 
b/be/src/pipeline/exec/hashjoin_build_sink.cpp
index 8539274061e..cc32f880570 100644
--- a/be/src/pipeline/exec/hashjoin_build_sink.cpp
+++ b/be/src/pipeline/exec/hashjoin_build_sink.cpp
@@ -234,8 +234,8 @@ Status 
HashJoinBuildSinkLocalState::process_build_block(RuntimeState* state,
         _convert_block_to_null(block);
         // first row is mocked
         for (int i = 0; i < block.columns(); i++) {
-            assert_cast<vectorized::ColumnNullable*>(
-                    
(*std::move(block.safe_get_by_position(i).column)).mutate().get())
+            auto [column, is_const] = 
unpack_if_const(block.safe_get_by_position(i).column);
+            
assert_cast<vectorized::ColumnNullable*>(column->assume_mutable().get())
                     ->get_null_map_column()
                     .get_data()
                     .data()[0] = 1;
@@ -476,14 +476,13 @@ Status HashJoinBuildSinkOperatorX::sink(RuntimeState* 
state, vectorized::Block*
     }
 
     if (local_state._should_build_hash_table && source_state == 
SourceState::FINISHED) {
-        if (!local_state._build_side_mutable_block.empty()) {
-            local_state._shared_state->build_block = 
std::make_shared<vectorized::Block>(
-                    local_state._build_side_mutable_block.to_block());
-            COUNTER_UPDATE(local_state._build_blocks_memory_usage,
-                           (*local_state._shared_state->build_block).bytes());
-            RETURN_IF_ERROR(local_state.process_build_block(
-                    state, (*local_state._shared_state->build_block)));
-        }
+        DCHECK(!local_state._build_side_mutable_block.empty());
+        local_state._shared_state->build_block = 
std::make_shared<vectorized::Block>(
+                local_state._build_side_mutable_block.to_block());
+        COUNTER_UPDATE(local_state._build_blocks_memory_usage,
+                       (*local_state._shared_state->build_block).bytes());
+        RETURN_IF_ERROR(
+                local_state.process_build_block(state, 
(*local_state._shared_state->build_block)));
         auto ret = std::visit(
                 Overload {[&](std::monostate&) -> Status {
                               LOG(FATAL) << "FATAL: uninited hash table";
diff --git a/be/src/pipeline/exec/hashjoin_probe_operator.h 
b/be/src/pipeline/exec/hashjoin_probe_operator.h
index d19900ff861..fac0aaef171 100644
--- a/be/src/pipeline/exec/hashjoin_probe_operator.h
+++ b/be/src/pipeline/exec/hashjoin_probe_operator.h
@@ -97,7 +97,7 @@ public:
     vectorized::DataTypes right_table_data_types();
     vectorized::DataTypes left_table_data_types();
     bool* has_null_in_build_side() { return 
&_shared_state->_has_null_in_build_side; }
-    std::shared_ptr<vectorized::Block> build_block() const { return 
_shared_state->build_block; }
+    const std::shared_ptr<vectorized::Block>& build_block() const { return 
_shared_state->build_block; }
 
 private:
     void _prepare_probe_block();
diff --git a/be/src/vec/exec/join/process_hash_table_probe.h 
b/be/src/vec/exec/join/process_hash_table_probe.h
index bfc628914b1..e1e893ce190 100644
--- a/be/src/vec/exec/join/process_hash_table_probe.h
+++ b/be/src/vec/exec/join/process_hash_table_probe.h
@@ -83,7 +83,7 @@ struct ProcessHashTableProbe {
 
     Parent* _parent;
     const int _batch_size;
-    std::shared_ptr<Block> _build_block;
+    const std::shared_ptr<Block>& _build_block;
     std::unique_ptr<Arena> _arena;
     std::vector<StringRef> _probe_keys;
 
diff --git a/be/src/vec/exec/join/vhash_join_node.h 
b/be/src/vec/exec/join/vhash_join_node.h
index 922c41f38fd..aecd49c8dbc 100644
--- a/be/src/vec/exec/join/vhash_join_node.h
+++ b/be/src/vec/exec/join/vhash_join_node.h
@@ -279,7 +279,7 @@ public:
     bool have_other_join_conjunct() const { return _have_other_join_conjunct; }
     bool is_right_semi_anti() const { return _is_right_semi_anti; }
     bool is_outer_join() const { return _is_outer_join; }
-    std::shared_ptr<Block> build_block() const { return _build_block; }
+    const std::shared_ptr<vectorized::Block>& build_block() const { return 
_build_block; }
     std::vector<bool>* left_output_slot_flags() { return 
&_left_output_slot_flags; }
     std::vector<bool>* right_output_slot_flags() { return 
&_right_output_slot_flags; }
     bool* has_null_in_build_side() { return &_has_null_in_build_side; }


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

Reply via email to