From d0990e270a7171d49d329e7de4d050a3d76e7eed Mon Sep 17 00:00:00 2001 From: Ilya Golshtein Date: Sat, 7 Aug 2021 00:52:34 +0300 Subject: [PATCH] making gcc happy, minor improvements in ORs in JOIN --- src/Interpreters/CollectJoinOnKeysVisitor.cpp | 6 +----- src/Interpreters/HashJoin.cpp | 7 ------- src/Interpreters/TableJoin.cpp | 16 ++++------------ src/Interpreters/TableJoin.h | 2 +- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/Interpreters/CollectJoinOnKeysVisitor.cpp b/src/Interpreters/CollectJoinOnKeysVisitor.cpp index fc15d242847..e6e9c37f3fc 100644 --- a/src/Interpreters/CollectJoinOnKeysVisitor.cpp +++ b/src/Interpreters/CollectJoinOnKeysVisitor.cpp @@ -36,11 +36,7 @@ void CollectJoinOnKeysMatcher::Data::setDisjuncts(const ASTPtr & or_func_ast) { const auto * func = or_func_ast->as(); const auto * func_args = func->arguments->as(); - TableJoin::Disjuncts v; - for (const auto & child : func_args->children) - { - v.push_back(child); - } + TableJoin::Disjuncts v = func_args->children; analyzed_join.setDisjuncts(std::move(v)); } diff --git a/src/Interpreters/HashJoin.cpp b/src/Interpreters/HashJoin.cpp index 59b46a82215..b0a3a7e57f9 100644 --- a/src/Interpreters/HashJoin.cpp +++ b/src/Interpreters/HashJoin.cpp @@ -748,15 +748,8 @@ bool HashJoin::addJoinedBlock(const Block & source_block, bool check_limits) JoinCommon::convertColumnsToNullable(structured_block.block); } std::vector join_mask_col_vector(disjuncts_num); - // std::vector join_mask_vector(disjuncts_num); - bool use_join_mask_col = false; for (size_t d = 0; d < disjuncts_num; ++d) - { join_mask_col_vector[d] = JoinCommon::getColumnAsMask(block, condition_mask_column_name_right[d]); - // join_mask_vector[d] = assert_cast(*(join_mask_col_vector[d])).getData(); - if (join_mask_col_vector[d]) - use_join_mask_col = true; - } std::vector null_map_vector; diff --git a/src/Interpreters/TableJoin.cpp b/src/Interpreters/TableJoin.cpp index d4cee1f7527..a77f8cbb026 100644 --- a/src/Interpreters/TableJoin.cpp +++ b/src/Interpreters/TableJoin.cpp @@ -115,19 +115,11 @@ void TableJoin::addDisjunct(const ASTPtr & ast) if (!key_names_left[disjunct_num].empty() || !on_filter_condition_asts_left[disjunct_num].empty() || !on_filter_condition_asts_right[disjunct_num].empty()) { disjunct_num++; - key_names_left.resize(disjunct_num+1); - key_names_right.resize(disjunct_num+1); - on_filter_condition_asts_left.resize(disjunct_num+1); - on_filter_condition_asts_right.resize(disjunct_num+1); + key_names_left.resize(disjunct_num + 1); + key_names_right.resize(disjunct_num + 1); + on_filter_condition_asts_left.resize(disjunct_num + 1); + on_filter_condition_asts_right.resize(disjunct_num + 1); } -#ifndef NDEBUG - else - { - /// we already have disjunct #0 , - /// that is why we are skipping left side of the very first AND - assert(!disjunct_num); - } -#endif } } diff --git a/src/Interpreters/TableJoin.h b/src/Interpreters/TableJoin.h index 263bf5103e8..820b5d80390 100644 --- a/src/Interpreters/TableJoin.h +++ b/src/Interpreters/TableJoin.h @@ -46,7 +46,7 @@ class TableJoin public: using NameToTypeMap = std::unordered_map; - using Disjuncts = std::deque; + using Disjuncts = ASTs; private: /** Query of the form `SELECT expr(x) AS k FROM t1 ANY LEFT JOIN (SELECT expr(x) AS k FROM t2) USING k`