From 510a909d0d91803e60ec1321a72e694bf0dff1df Mon Sep 17 00:00:00 2001 From: vdimir Date: Tue, 15 Feb 2022 11:15:50 +0000 Subject: [PATCH] Remove nullable_left/right_side flags from Hash/MergeJoin --- src/Interpreters/HashJoin.cpp | 16 ---------------- src/Interpreters/HashJoin.h | 2 -- src/Interpreters/MergeJoin.cpp | 8 -------- src/Interpreters/MergeJoin.h | 2 -- 4 files changed, 28 deletions(-) diff --git a/src/Interpreters/HashJoin.cpp b/src/Interpreters/HashJoin.cpp index feb5ecd4261..47bb1bfdd9f 100644 --- a/src/Interpreters/HashJoin.cpp +++ b/src/Interpreters/HashJoin.cpp @@ -232,8 +232,6 @@ HashJoin::HashJoin(std::shared_ptr table_join_, const Block & right_s : table_join(table_join_) , kind(table_join->kind()) , strictness(table_join->strictness()) - , nullable_right_side(false) - , nullable_left_side(false) , any_take_last_row(any_take_last_row_) , asof_inequality(table_join->getAsofInequality()) , data(std::make_shared()) @@ -273,9 +271,6 @@ HashJoin::HashJoin(std::shared_ptr table_join_, const Block & right_s JoinCommon::createMissedColumns(sample_block_with_columns_to_add); - if (nullable_right_side) - JoinCommon::convertColumnsToNullable(sample_block_with_columns_to_add); - size_t disjuncts_num = table_join->getClauses().size(); data->maps.resize(disjuncts_num); key_sizes.reserve(disjuncts_num); @@ -716,12 +711,6 @@ void HashJoin::initRightBlockStructure(Block & saved_block_sample) saved_block_sample.insert(column); } } - - if (nullable_right_side) - { - JoinCommon::convertColumnsToNullable(saved_block_sample, (isFull(kind) && !multiple_disjuncts ? right_table_keys.columns() : 0)); - } - } Block HashJoin::structureRightBlock(const Block & block) const @@ -1473,9 +1462,6 @@ void HashJoin::joinBlockImpl( if constexpr (jf.right || jf.full) { materializeBlockInplace(block); - - if (nullable_left_side) - JoinCommon::convertColumnsToNullable(block); } /** For LEFT/INNER JOIN, the saved blocks do not contain keys. @@ -1751,8 +1737,6 @@ void HashJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed) if (kind == ASTTableJoin::Kind::Right || kind == ASTTableJoin::Kind::Full) { materializeBlockInplace(block); - if (nullable_left_side) - JoinCommon::convertColumnsToNullable(block); } if (overDictionary()) diff --git a/src/Interpreters/HashJoin.h b/src/Interpreters/HashJoin.h index 50c8b2c55ee..4e5ab21f08d 100644 --- a/src/Interpreters/HashJoin.h +++ b/src/Interpreters/HashJoin.h @@ -360,8 +360,6 @@ private: /// This join was created from StorageJoin and it is already filled. bool from_storage_join = false; - bool nullable_right_side; /// In case of LEFT and FULL joins, if use_nulls, convert right-side columns to Nullable. - bool nullable_left_side; /// In case of RIGHT and FULL joins, if use_nulls, convert left-side columns to Nullable. bool any_take_last_row; /// Overwrite existing values when encountering the same key again std::optional asof_type; ASOF::Inequality asof_inequality; diff --git a/src/Interpreters/MergeJoin.cpp b/src/Interpreters/MergeJoin.cpp index a97d741225a..c51d54c13ff 100644 --- a/src/Interpreters/MergeJoin.cpp +++ b/src/Interpreters/MergeJoin.cpp @@ -465,8 +465,6 @@ MergeJoin::MergeJoin(std::shared_ptr table_join_, const Block & right : table_join(table_join_) , size_limits(table_join->sizeLimits()) , right_sample_block(right_sample_block_) - , nullable_right_side(false) - , nullable_left_side(false) , is_any_join(table_join->strictness() == ASTTableJoin::Strictness::Any) , is_all_join(table_join->strictness() == ASTTableJoin::Strictness::All) , is_semi_join(table_join->strictness() == ASTTableJoin::Strictness::Semi) @@ -545,9 +543,6 @@ MergeJoin::MergeJoin(std::shared_ptr table_join_, const Block & right JoinCommon::createMissedColumns(right_columns_to_add); - if (nullable_right_side) - JoinCommon::convertColumnsToNullable(right_columns_to_add); - makeSortAndMerge(key_names_left, left_sort_description, left_merge_description); makeSortAndMerge(key_names_right, right_sort_description, right_merge_description); @@ -710,9 +705,6 @@ void MergeJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed) JoinCommon::convertToFullColumnsInplace(block, key_names_left, false); sortBlock(block, left_sort_description); - - if (nullable_left_side) - JoinCommon::convertColumnsToNullable(block); } if (!not_processed && left_blocks_buffer) diff --git a/src/Interpreters/MergeJoin.h b/src/Interpreters/MergeJoin.h index 2cf287fd2fd..89570015d0f 100644 --- a/src/Interpreters/MergeJoin.h +++ b/src/Interpreters/MergeJoin.h @@ -102,8 +102,6 @@ private: SortedBlocksWriter::SortedFiles flushed_right_blocks; Block totals; std::atomic is_in_memory{true}; - const bool nullable_right_side; - const bool nullable_left_side; const bool is_any_join; const bool is_all_join; const bool is_semi_join;