mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
minor merge mistakes fixed in ORs in JOIN
This commit is contained in:
parent
8057e052a6
commit
fa6c2a64e4
@ -3,6 +3,8 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <common/logger_useful.h>
|
||||
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnVector.h>
|
||||
@ -24,14 +26,8 @@
|
||||
#include <DataStreams/materializeBlock.h>
|
||||
|
||||
#include <Core/ColumnNumbers.h>
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/format.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/assert_cast.h>
|
||||
#include "Columns/IColumn.h"
|
||||
|
||||
#include <common/logger_useful.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -232,19 +228,6 @@ static ColumnWithTypeAndName correctNullability(ColumnWithTypeAndName && column,
|
||||
return std::move(column);
|
||||
}
|
||||
|
||||
//static std::string formatKeysDebug(const std::vector<TableJoin::JoinOnClause> & onexprs)
|
||||
//{
|
||||
// std::vector<std::string> res;
|
||||
// for (const auto & onexpr : onexprs)
|
||||
// {
|
||||
// std::vector<std::string> current;
|
||||
// for (size_t i = 0; i < onexpr.keysCount(); ++i)
|
||||
// current.emplace_back(fmt::format("{} == {}", onexpr.key_names_left[i], onexpr.key_names_right[i]));
|
||||
// res.emplace_back(fmt::format("{}", fmt::join(current, ", ")));
|
||||
// }
|
||||
// return fmt::format("{}", fmt::join(res, " | "));
|
||||
//}
|
||||
|
||||
HashJoin::HashJoin(std::shared_ptr<TableJoin> table_join_, const Block & right_sample_block_, bool any_take_last_row_)
|
||||
: table_join(table_join_)
|
||||
, kind(table_join->kind())
|
||||
@ -295,7 +278,6 @@ HashJoin::HashJoin(std::shared_ptr<TableJoin> table_join_, const Block & right_s
|
||||
if (nullable_right_side)
|
||||
JoinCommon::convertColumnsToNullable(sample_block_with_columns_to_add);
|
||||
|
||||
|
||||
size_t disjuncts_num = table_join->getClauses().size();
|
||||
data->maps.resize(disjuncts_num);
|
||||
key_sizes.reserve(disjuncts_num);
|
||||
@ -1775,7 +1757,7 @@ void HashJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed)
|
||||
joinBlockImpl<Kind::Left, Strictness::Semi>(block, sample_block_with_columns_to_add, maps_vector);
|
||||
|
||||
else
|
||||
throw throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: {} {}", strictness, kind);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: {} {}", strictness, kind);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1792,7 +1774,7 @@ void HashJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed)
|
||||
/// Joined
|
||||
}
|
||||
else
|
||||
throw throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: {} {}", strictness, kind);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: {} {}", strictness, kind);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,6 @@ std::string formatTypeMap(const TableJoin::NameToTypeMap & target, const TableJo
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -146,8 +145,7 @@ bool operator==(const TableJoin::JoinOnClause & l, const TableJoin::JoinOnClause
|
||||
|
||||
TableJoin::JoinOnClause & operator+=(TableJoin::JoinOnClause & l, const TableJoin::JoinOnClause & r)
|
||||
{
|
||||
for (auto & cp :
|
||||
{std::pair(&l.on_filter_condition_left, &r.on_filter_condition_left),
|
||||
for (const auto & cp : {std::pair(&l.on_filter_condition_left, &r.on_filter_condition_left),
|
||||
std::pair(&l.on_filter_condition_right, &r.on_filter_condition_right) })
|
||||
{
|
||||
if (*cp.first == nullptr)
|
||||
@ -541,7 +539,8 @@ TableJoin::createConvertingActions(const ColumnsWithTypeAndName & left_sample_co
|
||||
return true;
|
||||
});
|
||||
|
||||
return {left_converting_actions, right_converting_actions};}
|
||||
return {left_converting_actions, right_converting_actions};
|
||||
}
|
||||
|
||||
template <typename LeftNamesAndTypes, typename RightNamesAndTypes>
|
||||
bool TableJoin::inferJoinKeyCommonType(const LeftNamesAndTypes & left, const RightNamesAndTypes & right, bool allow_right)
|
||||
@ -581,12 +580,11 @@ bool TableJoin::inferJoinKeyCommonType(const LeftNamesAndTypes & left, const Rig
|
||||
}
|
||||
catch (DB::Exception & ex)
|
||||
{
|
||||
throw Exception(
|
||||
"Type mismatch of columns to JOIN by: " +
|
||||
left_key_name + ": " + ltype->second->getName() + " at left, " +
|
||||
right_key_name + ": " + rtype->second->getName() + " at right. " +
|
||||
"Can't get supertype: " + ex.message(),
|
||||
ErrorCodes::TYPE_MISMATCH);
|
||||
throw DB::Exception(ErrorCodes::TYPE_MISMATCH,
|
||||
"Can't infer common type for joined columns: {}: {} at left, {}: {} at right. {}",
|
||||
left_key_name, ltype->second->getName(),
|
||||
right_key_name, rtype->second->getName(),
|
||||
ex.message());
|
||||
}
|
||||
if (!allow_right && !common_type->equals(*rtype->second))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user