mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #18750 from ClickHouse/fix-bad-code-joins
Remove bad code in HashJoin
This commit is contained in:
commit
fd27990d96
@ -357,10 +357,14 @@ void HashJoin::init(Type type_)
|
||||
joinDispatch(kind, strictness, data->maps, [&](auto, auto, auto & map) { map.create(data->type); });
|
||||
}
|
||||
|
||||
size_t HashJoin::getTotalRowCount() const
|
||||
bool HashJoin::overDictionary() const
|
||||
{
|
||||
std::shared_lock lock(data->rwlock);
|
||||
return getTotalRowCountLocked();
|
||||
return data->type == Type::DICT;
|
||||
}
|
||||
|
||||
bool HashJoin::empty() const
|
||||
{
|
||||
return data->type == Type::EMPTY;
|
||||
}
|
||||
|
||||
size_t HashJoin::getTotalByteCount() const
|
||||
@ -369,6 +373,18 @@ size_t HashJoin::getTotalByteCount() const
|
||||
return getTotalByteCountLocked();
|
||||
}
|
||||
|
||||
size_t HashJoin::getTotalRowCount() const
|
||||
{
|
||||
std::shared_lock lock(data->rwlock);
|
||||
return getTotalRowCountLocked();
|
||||
}
|
||||
|
||||
bool HashJoin::alwaysReturnsEmptySet() const
|
||||
{
|
||||
std::shared_lock lock(data->rwlock);
|
||||
return isInnerOrRight(getKind()) && data->empty && !overDictionary();
|
||||
}
|
||||
|
||||
size_t HashJoin::getTotalRowCountLocked() const
|
||||
{
|
||||
size_t res = 0;
|
||||
|
@ -150,9 +150,6 @@ class HashJoin : public IJoin
|
||||
public:
|
||||
HashJoin(std::shared_ptr<TableJoin> table_join_, const Block & right_sample_block, bool any_take_last_row_ = false);
|
||||
|
||||
bool empty() const { return data->type == Type::EMPTY; }
|
||||
bool overDictionary() const { return data->type == Type::DICT; }
|
||||
|
||||
/** Add block of data from right hand of JOIN to the map.
|
||||
* Returns false, if some limit was exceeded and you should not insert more data.
|
||||
*/
|
||||
@ -188,7 +185,7 @@ public:
|
||||
/// Sum size in bytes of all buffers, used for JOIN maps and for all memory pools.
|
||||
size_t getTotalByteCount() const final;
|
||||
|
||||
bool alwaysReturnsEmptySet() const final { return isInnerOrRight(getKind()) && data->empty && !overDictionary(); }
|
||||
bool alwaysReturnsEmptySet() const final;
|
||||
|
||||
ASTTableJoin::Kind getKind() const { return kind; }
|
||||
ASTTableJoin::Strictness getStrictness() const { return strictness; }
|
||||
@ -397,6 +394,9 @@ private:
|
||||
/// Call with already locked rwlock.
|
||||
size_t getTotalRowCountLocked() const;
|
||||
size_t getTotalByteCountLocked() const;
|
||||
|
||||
bool empty() const;
|
||||
bool overDictionary() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user