diff --git a/dbms/src/Interpreters/Join.cpp b/dbms/src/Interpreters/Join.cpp index 8c6b8d1d67c..a98fa774ee6 100644 --- a/dbms/src/Interpreters/Join.cpp +++ b/dbms/src/Interpreters/Join.cpp @@ -516,8 +516,10 @@ namespace } } + /// Joins right table columns which indexes are present in right_indexes using specified map. + /// Makes filter (1 if row presented in right table) and returns offsets to replicate (for ALL JOINS). template - std::unique_ptr NO_INLINE joinRightIndexColumns( + std::unique_ptr NO_INLINE joinRightIndexedColumns( const Map & map, size_t rows, KeyGetter & key_getter, MutableColumns & added_columns, ConstNullMapPtr null_map, IColumn::Filter & filter, const std::vector & right_indexes) @@ -560,7 +562,7 @@ namespace } template - IColumn::Filter joinRightIndex( + IColumn::Filter joinRightColumns( const Map & map, size_t rows, const ColumnRawPtrs & key_columns, const Sizes & key_sizes, MutableColumns & added_columns, ConstNullMapPtr null_map, const std::vector & right_indexes, std::unique_ptr & offsets_to_replicate) @@ -569,17 +571,17 @@ namespace KeyGetter key_getter(key_columns, key_sizes, nullptr); if (null_map) - offsets_to_replicate = joinRightIndexColumns( + offsets_to_replicate = joinRightIndexedColumns( map, rows, key_getter, added_columns, null_map, filter, right_indexes); else - offsets_to_replicate = joinRightIndexColumns( + offsets_to_replicate = joinRightIndexedColumns( map, rows, key_getter, added_columns, null_map, filter, right_indexes); return filter; } template - IColumn::Filter switchJoinRightIndex( + IColumn::Filter switchJoinRightColumns( Join::Type type, const Maps & maps_, size_t rows, const ColumnRawPtrs & key_columns, const Sizes & key_sizes, MutableColumns & added_columns, ConstNullMapPtr null_map, const std::vector & right_indexes, @@ -589,7 +591,7 @@ namespace { #define M(TYPE) \ case Join::Type::TYPE: \ - return joinRightIndex>::Type>(\ + return joinRightColumns>::Type>(\ *maps_.TYPE, rows, key_columns, key_sizes, added_columns, null_map, right_indexes, offsets_to_replicate); APPLY_FOR_JOIN_VARIANTS(M) #undef M @@ -716,7 +718,7 @@ void Join::joinBlockImpl( std::unique_ptr offsets_to_replicate; - IColumn::Filter filter = switchJoinRightIndex( + IColumn::Filter filter = switchJoinRightColumns( type, maps_, block.rows(), key_columns, key_sizes, added.columns, null_map, right_indexes, offsets_to_replicate); for (size_t i = 0; i < added.columns.size(); ++i)