mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
correct fallback for PREFER_PARTIAL_MERGE: HashJoin -> MergeJoin instead of HashJoin -> JoinSwitcher
This commit is contained in:
parent
3d7959d2e8
commit
56fa3cc1eb
@ -90,7 +90,7 @@ public:
|
||||
const SizeLimits & sizeLimits() const { return size_limits; }
|
||||
VolumePtr getTemporaryVolume() { return tmp_volume; }
|
||||
bool allowMergeJoin() const;
|
||||
bool preferMergeJoin() const { return allowMergeJoin() && join_algorithm == JoinAlgorithm::PREFER_PARTIAL_MERGE; }
|
||||
bool preferMergeJoin() const { return join_algorithm == JoinAlgorithm::PREFER_PARTIAL_MERGE; }
|
||||
bool forceMergeJoin() const { return join_algorithm == JoinAlgorithm::PARTIAL_MERGE; }
|
||||
bool forceHashJoin() const { return join_algorithm == JoinAlgorithm::HASH; }
|
||||
|
||||
|
@ -542,9 +542,11 @@ static ExpressionActionsPtr createJoinedBlockActions(const Context & context, co
|
||||
|
||||
static std::shared_ptr<IJoin> makeJoin(std::shared_ptr<AnalyzedJoin> analyzed_join, const Block & sample_block)
|
||||
{
|
||||
if (analyzed_join->forceHashJoin())
|
||||
bool allow_merge_join = analyzed_join->allowMergeJoin();
|
||||
|
||||
if (analyzed_join->forceHashJoin() || (analyzed_join->preferMergeJoin() && !allow_merge_join))
|
||||
return std::make_shared<Join>(analyzed_join, sample_block);
|
||||
else if (analyzed_join->forceMergeJoin() || analyzed_join->preferMergeJoin())
|
||||
else if (analyzed_join->forceMergeJoin() || (analyzed_join->preferMergeJoin() && allow_merge_join))
|
||||
return std::make_shared<MergeJoin>(analyzed_join, sample_block);
|
||||
return std::make_shared<JoinSwitcher>(analyzed_join, sample_block);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user