diff --git a/dbms/src/Interpreters/JoinPartition.cpp b/dbms/src/Interpreters/JoinPartition.cpp index 9023fcac831..9b55c493014 100644 --- a/dbms/src/Interpreters/JoinPartition.cpp +++ b/dbms/src/Interpreters/JoinPartition.cpp @@ -1202,89 +1202,6 @@ void cacheColumns(CachedColumnInfo * cached_column_info, MutableColumns & added_ cached_column_info->state = CachedColumnState::CACHED; } -template -struct Adder -{ - static bool addFound( - const typename Map::ConstLookupResult & it, - size_t num_columns_to_add, - MutableColumns & added_columns, - size_t i, - IColumn::Filter * /*filter*/, - IColumn::Offset & current_offset, - IColumn::Offsets * offsets, - const std::vector & right_indexes, - ProbeProcessInfo & probe_process_info) - { - auto & mapped_value = static_cast(it->getMapped()); - size_t rows_joined = mapped_value.list_length; - bool need_generate_cached_columns = false; - auto * current = &mapped_value; - auto add_one_row = [&]() { - for (size_t j = 0; j < num_columns_to_add - 1; ++j) - added_columns[j]->insertFrom( - *current->block->getByPosition(right_indexes[j]).column.get(), - current->row_num); - }; - if unlikely ( - probe_process_info.cache_columns_threshold > 0 && rows_joined >= probe_process_info.cache_columns_threshold) - { - assert(mapped_value.cached_column_info != nullptr); - auto check_result = checkCachedColumnInfo(mapped_value.cached_column_info); - need_generate_cached_columns = check_result.second; - if (check_result.first) - { - insertCachedColumns( - mapped_value.cached_column_info, - added_columns, - rows_joined, - num_columns_to_add - 1); - current_offset += rows_joined; - (*offsets)[i] = current_offset; - /// we insert only one row to `match-helper` for each row of left block - /// so before the execution of `HandleOtherConditions`, column sizes of temporary block may be different. - added_columns[num_columns_to_add - 1]->insert(FIELD_INT8_1); - return false; - } - add_one_row(); - current = static_cast(current->cached_column_info->next); - } - for (; current != nullptr; current = current->next) - { - add_one_row(); - } - current_offset += rows_joined; - (*offsets)[i] = current_offset; - /// we insert only one row to `match-helper` for each row of left block - /// so before the execution of `HandleOtherConditions`, column sizes of temporary block may be different. - added_columns[num_columns_to_add - 1]->insert(FIELD_INT8_1); - - if unlikely (need_generate_cached_columns) - { - cacheColumns(mapped_value.cached_column_info, added_columns, rows_joined, num_columns_to_add - 1); - } - return false; - } - - static bool addNotFound( - size_t num_columns_to_add, - MutableColumns & added_columns, - size_t i, - IColumn::Filter * /*filter*/, - IColumn::Offset & current_offset, - IColumn::Offsets * offsets, - ProbeProcessInfo & /*probe_process_info*/) - { - ++current_offset; - (*offsets)[i] = current_offset; - - for (size_t j = 0; j < num_columns_to_add - 1; ++j) - added_columns[j]->insertDefault(); - added_columns[num_columns_to_add - 1]->insert(FIELD_INT8_0); - return false; - } -}; - template struct Adder {