From b8b6197288fe9b8196e711ae7e51b0e183e37764 Mon Sep 17 00:00:00 2001 From: chertus Date: Wed, 18 Sep 2019 22:12:53 +0300 Subject: [PATCH] partial_merge_join settings affects LEFT and INNER JOINs only --- dbms/src/Core/Settings.h | 2 +- dbms/src/Interpreters/AnalyzedJoin.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dbms/src/Core/Settings.h b/dbms/src/Core/Settings.h index d1f5994df16..cacaf883fb7 100644 --- a/dbms/src/Core/Settings.h +++ b/dbms/src/Core/Settings.h @@ -288,7 +288,7 @@ struct Settings : public SettingsCollection M(SettingUInt64, max_bytes_in_join, 0, "Maximum size of the hash table for JOIN (in number of bytes in memory).") \ M(SettingOverflowMode, join_overflow_mode, OverflowMode::THROW, "What to do when the limit is exceeded.") \ M(SettingBool, join_any_take_last_row, false, "When disabled (default) ANY JOIN will take the first found row for a key. When enabled, it will take the last row seen if there are multiple rows for the same key.") \ - M(SettingBool, partial_merge_join, false, "Use partial merge join instead of hash join if possible.") \ + M(SettingBool, partial_merge_join, false, "Use partial merge join instead of hash join for LEFT and INNER JOINs.") \ \ M(SettingUInt64, max_rows_to_transfer, 0, "Maximum size (in rows) of the transmitted external table obtained when the GLOBAL IN/JOIN section is executed.") \ M(SettingUInt64, max_bytes_to_transfer, 0, "Maximum size (in uncompressed bytes) of the transmitted external table obtained when the GLOBAL IN/JOIN section is executed.") \ diff --git a/dbms/src/Interpreters/AnalyzedJoin.cpp b/dbms/src/Interpreters/AnalyzedJoin.cpp index 5da4a7219d0..53f763d54dd 100644 --- a/dbms/src/Interpreters/AnalyzedJoin.cpp +++ b/dbms/src/Interpreters/AnalyzedJoin.cpp @@ -262,7 +262,10 @@ NamesAndTypesList getNamesAndTypeListFromTableExpression(const ASTTableExpressio JoinPtr makeJoin(std::shared_ptr table_join, const Block & right_sample_block) { - if (table_join->partial_merge_join) + bool is_left_or_inner = isLeft(table_join->kind()) || isInner(table_join->kind()); + bool is_asof = (table_join->strictness() == ASTTableJoin::Strictness::Asof); + + if (table_join->partial_merge_join && !is_asof && is_left_or_inner) return std::make_shared(table_join, right_sample_block); return std::make_shared(table_join, right_sample_block); }