mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
stash half
This commit is contained in:
parent
e3caa59f83
commit
9c55ad799b
@ -108,6 +108,20 @@ private:
|
|||||||
Arena & pool,
|
Arena & pool,
|
||||||
bool & is_inserted);
|
bool & is_inserted);
|
||||||
|
|
||||||
|
template <typename KeyGetter, typename HashMap, typename Selector>
|
||||||
|
static size_t insertFromBlockImplTypeCase(
|
||||||
|
HashJoin & join,
|
||||||
|
HashMap & map,
|
||||||
|
const ColumnRawPtrs & key_columns,
|
||||||
|
const Sizes & key_sizes,
|
||||||
|
Block * stored_block,
|
||||||
|
const Selector & selector,
|
||||||
|
size_t rows,
|
||||||
|
ConstNullMapPtr null_map,
|
||||||
|
UInt8ColumnDataPtr join_mask,
|
||||||
|
Arena & pool,
|
||||||
|
bool & is_inserted);
|
||||||
|
|
||||||
template <typename AddedColumns>
|
template <typename AddedColumns>
|
||||||
static size_t switchJoinRightColumns(
|
static size_t switchJoinRightColumns(
|
||||||
const std::vector<const MapsTemplate *> & mapv,
|
const std::vector<const MapsTemplate *> & mapv,
|
||||||
@ -138,6 +152,14 @@ private:
|
|||||||
AddedColumns & added_columns,
|
AddedColumns & added_columns,
|
||||||
JoinStuff::JoinUsedFlags & used_flags);
|
JoinStuff::JoinUsedFlags & used_flags);
|
||||||
|
|
||||||
|
template <typename KeyGetter, typename Map, bool need_filter, bool flag_per_row, typename AddedColumns, typename Selector>
|
||||||
|
static size_t joinRightColumns(
|
||||||
|
std::vector<KeyGetter> && key_getter_vector,
|
||||||
|
const std::vector<const Map *> & mapv,
|
||||||
|
AddedColumns & added_columns,
|
||||||
|
JoinStuff::JoinUsedFlags & used_flags,
|
||||||
|
const Selector & selector);
|
||||||
|
|
||||||
template <bool need_filter>
|
template <bool need_filter>
|
||||||
static void setUsed(IColumn::Filter & filter [[maybe_unused]], size_t pos [[maybe_unused]]);
|
static void setUsed(IColumn::Filter & filter [[maybe_unused]], size_t pos [[maybe_unused]]);
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <type_traits>
|
||||||
#include <Interpreters/HashJoin/HashJoinMethods.h>
|
#include <Interpreters/HashJoin/HashJoinMethods.h>
|
||||||
|
#include "Columns/IColumn.h"
|
||||||
|
#include "Interpreters/HashJoin/ScatteredBlock.h"
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
@ -334,6 +337,24 @@ size_t HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::joinRightColumns(
|
|||||||
const std::vector<const Map *> & mapv,
|
const std::vector<const Map *> & mapv,
|
||||||
AddedColumns & added_columns,
|
AddedColumns & added_columns,
|
||||||
JoinStuff::JoinUsedFlags & used_flags)
|
JoinStuff::JoinUsedFlags & used_flags)
|
||||||
|
{
|
||||||
|
auto & block = added_columns.src_block;
|
||||||
|
if (block.getSelector().isContinuousRange())
|
||||||
|
return joinRightColumns<KeyGetter, Map, need_filter, flag_per_row, AddedColumns>(
|
||||||
|
std::move(key_getter_vector), mapv, added_columns, used_flags, block.getSelector().getRange());
|
||||||
|
else
|
||||||
|
return joinRightColumns<KeyGetter, Map, need_filter, flag_per_row, AddedColumns>(
|
||||||
|
std::move(key_getter_vector), mapv, added_columns, used_flags, block.getSelector().getSelector());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <JoinKind KIND, JoinStrictness STRICTNESS, typename MapsTemplate>
|
||||||
|
template <typename KeyGetter, typename Map, bool need_filter, bool flag_per_row, typename AddedColumns, typename Selector>
|
||||||
|
size_t HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::joinRightColumns(
|
||||||
|
std::vector<KeyGetter> && key_getter_vector,
|
||||||
|
const std::vector<const Map *> & mapv,
|
||||||
|
AddedColumns & added_columns,
|
||||||
|
JoinStuff::JoinUsedFlags & used_flags,
|
||||||
|
const Selector & selector)
|
||||||
{
|
{
|
||||||
constexpr JoinFeatures<KIND, STRICTNESS, MapsTemplate> join_features;
|
constexpr JoinFeatures<KIND, STRICTNESS, MapsTemplate> join_features;
|
||||||
|
|
||||||
@ -352,7 +373,12 @@ size_t HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::joinRightColumns(
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < rows; ++i)
|
for (; i < rows; ++i)
|
||||||
{
|
{
|
||||||
const auto ind = block.getSelector()[i];
|
size_t ind = 0;
|
||||||
|
if constexpr (std::is_same_v<std::decay_t<Selector>, IColumn::Selector>)
|
||||||
|
ind = selector[i];
|
||||||
|
else
|
||||||
|
ind = selector.first + i;
|
||||||
|
|
||||||
if constexpr (join_features.need_replication)
|
if constexpr (join_features.need_replication)
|
||||||
{
|
{
|
||||||
if (unlikely(current_offset >= max_joined_block_rows))
|
if (unlikely(current_offset >= max_joined_block_rows))
|
||||||
|
@ -133,6 +133,12 @@ public:
|
|||||||
return std::get<Range>(data);
|
return std::get<Range>(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const IColumn::Selector & getSelector() const
|
||||||
|
{
|
||||||
|
chassert(!isContinuousRange());
|
||||||
|
return std::get<IColumn::Selector>(data);
|
||||||
|
}
|
||||||
|
|
||||||
std::string toString() const
|
std::string toString() const
|
||||||
{
|
{
|
||||||
if (std::holds_alternative<Range>(data))
|
if (std::holds_alternative<Range>(data))
|
||||||
|
Loading…
Reference in New Issue
Block a user