diff --git a/src/Interpreters/HashJoin/HashJoinMethodsImpl.h b/src/Interpreters/HashJoin/HashJoinMethodsImpl.h index 105b6e5d5bf..9b92e44d64a 100644 --- a/src/Interpreters/HashJoin/HashJoinMethodsImpl.h +++ b/src/Interpreters/HashJoin/HashJoinMethodsImpl.h @@ -122,9 +122,6 @@ ScatteredBlock HashJoinMethods::joinBlockImpl( block.filterBySelector(); - for (size_t i = 0; i < added_columns.size(); ++i) - source_block.insert(added_columns.moveColumn(i)); - const auto & table_join = join.table_join; std::set block_columns_to_erase; if (join.canRemoveColumnsFromLeftBlock()) @@ -139,6 +136,9 @@ ScatteredBlock HashJoinMethods::joinBlockImpl( } } + for (size_t i = 0; i < added_columns.size(); ++i) + source_block.insert(added_columns.moveColumn(i)); + std::vector right_keys_to_replicate [[maybe_unused]]; if constexpr (join_features.need_filter)