mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 20:32:43 +00:00
better
This commit is contained in:
parent
55c9a92e3e
commit
06901e1c6a
@ -9,10 +9,6 @@
|
|||||||
#include <Interpreters/TableJoin.h>
|
#include <Interpreters/TableJoin.h>
|
||||||
#include <Interpreters/castColumn.h>
|
#include <Interpreters/castColumn.h>
|
||||||
|
|
||||||
#include <Poco/Logger.h>
|
|
||||||
#include <Common/logger_useful.h>
|
|
||||||
#include "Parsers/ExpressionListParsers.h"
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
/// Inserting an element into a hash table of the form `key -> reference to a string`, which will then be used by JOIN.
|
/// Inserting an element into a hash table of the form `key -> reference to a string`, which will then be used by JOIN.
|
||||||
|
@ -358,12 +358,6 @@ size_t HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::joinRightColumnsSwitchMu
|
|||||||
if (added_columns.additional_filter_expression)
|
if (added_columns.additional_filter_expression)
|
||||||
{
|
{
|
||||||
const bool mark_per_row_used = join_features.right || join_features.full || mapv.size() > 1;
|
const bool mark_per_row_used = join_features.right || join_features.full || mapv.size() > 1;
|
||||||
LOG_DEBUG(
|
|
||||||
&Poco::Logger::get("debug"),
|
|
||||||
"__PRETTY_FUNCTION__={}, __LINE__={}, mark_per_row_used={}",
|
|
||||||
__PRETTY_FUNCTION__,
|
|
||||||
__LINE__,
|
|
||||||
mark_per_row_used);
|
|
||||||
return joinRightColumnsWithAddtitionalFilter<KeyGetter, Map>(
|
return joinRightColumnsWithAddtitionalFilter<KeyGetter, Map>(
|
||||||
std::forward<std::vector<KeyGetter>>(key_getter_vector),
|
std::forward<std::vector<KeyGetter>>(key_getter_vector),
|
||||||
mapv,
|
mapv,
|
||||||
@ -576,14 +570,12 @@ ColumnPtr HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::buildAdditionalFilter
|
|||||||
result_column = ColumnUInt8::create();
|
result_column = ColumnUInt8::create();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG_DEBUG(&Poco::Logger::get("debug"), "__PRETTY_FUNCTION__={}, __LINE__={}", __PRETTY_FUNCTION__, __LINE__);
|
|
||||||
const Block & sample_right_block = *((*selected_rows.begin())->block);
|
const Block & sample_right_block = *((*selected_rows.begin())->block);
|
||||||
if (!sample_right_block || !added_columns.additional_filter_expression)
|
if (!sample_right_block || !added_columns.additional_filter_expression)
|
||||||
{
|
{
|
||||||
auto filter = ColumnUInt8::create();
|
auto filter = ColumnUInt8::create();
|
||||||
filter->insertMany(1, selected_rows.size());
|
filter->insertMany(1, selected_rows.size());
|
||||||
result_column = std::move(filter);
|
result_column = std::move(filter);
|
||||||
LOG_DEBUG(&Poco::Logger::get("debug"), "__PRETTY_FUNCTION__={}, __LINE__={}", __PRETTY_FUNCTION__, __LINE__);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,7 +585,6 @@ ColumnPtr HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::buildAdditionalFilter
|
|||||||
Block block;
|
Block block;
|
||||||
added_columns.additional_filter_expression->execute(block);
|
added_columns.additional_filter_expression->execute(block);
|
||||||
result_column = block.getByPosition(0).column->cloneResized(selected_rows.size());
|
result_column = block.getByPosition(0).column->cloneResized(selected_rows.size());
|
||||||
LOG_DEBUG(&Poco::Logger::get("debug"), "__PRETTY_FUNCTION__={}, __LINE__={}", __PRETTY_FUNCTION__, __LINE__);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NameSet required_column_names;
|
NameSet required_column_names;
|
||||||
@ -610,14 +601,6 @@ ColumnPtr HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::buildAdditionalFilter
|
|||||||
for (const auto & selected_row : selected_rows)
|
for (const auto & selected_row : selected_rows)
|
||||||
{
|
{
|
||||||
const auto & src_col = selected_row->block->getByPosition(right_col_pos);
|
const auto & src_col = selected_row->block->getByPosition(right_col_pos);
|
||||||
if (executed_block.columns() == 0)
|
|
||||||
LOG_DEBUG(
|
|
||||||
&Poco::Logger::get("debug"),
|
|
||||||
"__PRETTY_FUNCTION__={}, __LINE__={}, src_col.name={}, selected_row->row_num={}",
|
|
||||||
__PRETTY_FUNCTION__,
|
|
||||||
__LINE__,
|
|
||||||
src_col.name,
|
|
||||||
selected_row->row_num);
|
|
||||||
new_col->insertFrom(*src_col.column, selected_row->row_num);
|
new_col->insertFrom(*src_col.column, selected_row->row_num);
|
||||||
}
|
}
|
||||||
executed_block.insert({std::move(new_col), col.type, col.name});
|
executed_block.insert({std::move(new_col), col.type, col.name});
|
||||||
@ -637,9 +620,7 @@ ColumnPtr HashJoinMethods<KIND, STRICTNESS, MapsTemplate>::buildAdditionalFilter
|
|||||||
const size_t & left_offset = row_replicate_offset[i];
|
const size_t & left_offset = row_replicate_offset[i];
|
||||||
size_t rows = left_offset - prev_left_offset;
|
size_t rows = left_offset - prev_left_offset;
|
||||||
if (rows)
|
if (rows)
|
||||||
{
|
|
||||||
new_col->insertManyFrom(*src_col->column, selector[left_start_row + i - 1], rows);
|
new_col->insertManyFrom(*src_col->column, selector[left_start_row + i - 1], rows);
|
||||||
}
|
|
||||||
prev_left_offset = left_offset;
|
prev_left_offset = left_offset;
|
||||||
}
|
}
|
||||||
executed_block.insert({std::move(new_col), src_col->type, col_name});
|
executed_block.insert({std::move(new_col), src_col->type, col_name});
|
||||||
|
Loading…
Reference in New Issue
Block a user