mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
dbms: adding checking of types when JOIN (incomplete) [#METR-16762].
This commit is contained in:
parent
b417ef015f
commit
161d30c902
@ -250,6 +250,9 @@ private:
|
||||
|
||||
/// Проверить не превышены ли допустимые размеры множества
|
||||
bool checkSizeLimits() const;
|
||||
|
||||
/// Кинуть исключение, если в блоках не совпадают типы ключей.
|
||||
void checkTypesOfKeys(const Block & block_left, const Block & block_right) const;
|
||||
};
|
||||
|
||||
typedef Poco::SharedPtr<Join> JoinPtr;
|
||||
|
@ -650,10 +650,25 @@ void Join::joinBlockImpl(Block & block, const Maps & maps) const
|
||||
}
|
||||
|
||||
|
||||
void Join::checkTypesOfKeys(const Block & block_left, const Block & block_right) const
|
||||
{
|
||||
size_t keys_size = key_names_left.size();
|
||||
|
||||
for (size_t i = 0; i < keys_size; ++i)
|
||||
if (block_left.getByName(key_names_left[i]).type->getName() != block_right.getByName(key_names_right[i]).type->getName())
|
||||
throw Exception("Type mismatch of columns to JOIN by: "
|
||||
+ key_names_left[i] + " " + block_left.getByName(key_names_left[i]).type->getName() + " at left, "
|
||||
+ key_names_right[i] + " " + block_right.getByName(key_names_right[i]).type->getName() + " at right, ",
|
||||
ErrorCodes::TYPE_MISMATCH);
|
||||
}
|
||||
|
||||
|
||||
void Join::joinBlock(Block & block) const
|
||||
{
|
||||
Poco::ScopedReadRWLock lock(rwlock);
|
||||
|
||||
// checkTypesOfKeys(block, sample_block);
|
||||
|
||||
if (kind == ASTJoin::Left && strictness == ASTJoin::Any)
|
||||
joinBlockImpl<ASTJoin::Left, ASTJoin::Any>(block, maps_any);
|
||||
else if (kind == ASTJoin::Inner && strictness == ASTJoin::Any)
|
||||
|
Loading…
Reference in New Issue
Block a user