Skip to content
Open
10 changes: 5 additions & 5 deletions src/Core/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2130,14 +2130,14 @@ ClickHouse applies this setting when the query contains the product of object st

Restrictions:

- Only applied for JOIN subqueries.
- Only if the FROM section uses a object storage cluster function or table.
- Only applied for `JOIN` and for `IN`/`WHERE` subqueries that reference other tables.
- Only if the FROM section uses an object storage cluster function or table.

Possible values:

- `local` — Replaces the database and table in the subquery with local ones for the destination server (shard), leaving the normal `IN`/`JOIN.`
- `global` — Replaces the `IN`/`JOIN` query with `GLOBAL IN`/`GLOBAL JOIN.` Right table executes first and is added to the secondary query as temporay table.
- `allow` — Default value. Allows the use of these types of subqueries.
- `global` — Replaces the `IN`/`JOIN` query with `GLOBAL IN`/`GLOBAL JOIN`. Right table executes first and is added to the secondary query as a temporary table.
- `allow` — Default value. Reads the left object-storage table on cluster nodes and executes `JOIN` / local `IN` on the initiator, so the right table does not need to exist on remote nodes.
- `local` — Deprecated legacy alias of `allow`.
)", 0) \
\
DECLARE(UInt64, max_concurrent_queries_for_all_users, 0, R"(
Expand Down
4 changes: 2 additions & 2 deletions src/Core/SettingsEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ DECLARE_SETTING_ENUM(DistributedProductMode)
/// The setting for executing object storage cluster function or table JOIN sections.
enum class ObjectStorageClusterJoinMode : uint8_t
{
LOCAL, /// Convert to local query
LOCAL, /// Legacy alias of ALLOW: initiator-local join
GLOBAL, /// Convert to global query
ALLOW /// Enable
ALLOW /// Initiator-local join when the right table is not on remote nodes
};

DECLARE_SETTING_ENUM(ObjectStorageClusterJoinMode)
Expand Down
9 changes: 9 additions & 0 deletions src/Interpreters/InterpreterSelectQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ namespace Setting
extern const SettingsBool enable_lazy_columns_replication;
extern const SettingsBool serialize_string_in_memory_with_zero_byte;
extern const SettingsBool use_hive_partitioning;
extern const SettingsBool allow_experimental_analyzer;
extern const SettingsObjectStorageClusterJoinMode object_storage_cluster_join_mode;
}

namespace ServerSetting
Expand Down Expand Up @@ -758,6 +760,13 @@ InterpreterSelectQuery::InterpreterSelectQuery(

joined_tables.rewriteDistributedInAndJoins(query_ptr);

if (storage && !settings[Setting::allow_experimental_analyzer]
&& settings[Setting::object_storage_cluster_join_mode] == ObjectStorageClusterJoinMode::GLOBAL
&& dynamic_cast<const IStorageCluster *>(storage.get()))
{
IStorageCluster::rewriteASTForGlobalJoin(query_ptr);
}

max_streams = getMaxThreadsForAvailableMemory(
settings[Setting::max_threads], settings[Setting::max_threads_min_free_memory_per_thread]);
ASTSelectQuery & query = getSelectQuery();
Expand Down
Loading
Loading