From dfdbcbf867d88911ef3899be5ebc43290e30445b Mon Sep 17 00:00:00 2001 From: Andrey Zvonov Date: Mon, 16 Mar 2026 10:45:33 +0100 Subject: [PATCH 1/4] add allow_local_data_lakes --- src/Core/Settings.cpp | 3 +++ src/Core/SettingsChangesHistory.cpp | 4 ++++ .../ObjectStorage/registerStorageObjectStorage.cpp | 11 +++++++++++ src/TableFunctions/TableFunctionObjectStorage.cpp | 11 +++++++++++ .../test_storage_iceberg/configs/users.d/users.xml | 1 + 5 files changed, 30 insertions(+) diff --git a/src/Core/Settings.cpp b/src/Core/Settings.cpp index 509738fc8b08..4284793eb44b 100644 --- a/src/Core/Settings.cpp +++ b/src/Core/Settings.cpp @@ -5975,6 +5975,9 @@ This only affects operations performed on the client side, in particular parsing Normally this setting should be set in user profile (users.xml or queries like `ALTER USER`), not through the client (client command line arguments, `SET` query, or `SETTINGS` section of `SELECT` query). Through the client it can be changed to false, but can't be changed to true (because the server won't send the settings if user profile has `apply_settings_from_server = false`). Note that initially (24.12) there was a server setting (`send_settings_to_client`), but latter it got replaced with this client setting, for better usability. +)", 0) \ + DECLARE(Bool, allow_local_data_lakes, false, R"( +Allow using local data lake engines and table functions (IcebergLocal, DeltaLakeLocal, etc.). )", 0) \ \ /* ####################################################### */ \ diff --git a/src/Core/SettingsChangesHistory.cpp b/src/Core/SettingsChangesHistory.cpp index 4707d321b966..d083481bff09 100644 --- a/src/Core/SettingsChangesHistory.cpp +++ b/src/Core/SettingsChangesHistory.cpp @@ -69,6 +69,10 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory() addSettingsChanges(settings_changes_history, "25.4", { }); + addSettingsChanges(settings_changes_history, "25.3.8", + { + {"allow_local_data_lakes", false, false, "New setting to guard local data lake engines and table functions"}, + }); addSettingsChanges(settings_changes_history, "25.3", { /// Release closed. Please use 25.4 diff --git a/src/Storages/ObjectStorage/registerStorageObjectStorage.cpp b/src/Storages/ObjectStorage/registerStorageObjectStorage.cpp index f62b9cae37f0..a1d6537a0428 100644 --- a/src/Storages/ObjectStorage/registerStorageObjectStorage.cpp +++ b/src/Storages/ObjectStorage/registerStorageObjectStorage.cpp @@ -18,6 +18,12 @@ namespace DB namespace ErrorCodes { extern const int BAD_ARGUMENTS; + extern const int SUPPORT_IS_DISABLED; +} + +namespace Setting +{ + extern const SettingsBool allow_local_data_lakes; } namespace @@ -235,6 +241,11 @@ void registerStorageIceberg(StorageFactory & factory) "IcebergLocal", [&](const StorageFactory::Arguments & args) { + if (!args.getLocalContext()->getSettingsRef()[Setting::allow_local_data_lakes]) + throw Exception( + ErrorCodes::SUPPORT_IS_DISABLED, + "IcebergLocal is disabled. Set `allow_local_data_lakes` to enable it"); + auto configuration = std::make_shared(); return createStorageObjectStorage(args, configuration); }, diff --git a/src/TableFunctions/TableFunctionObjectStorage.cpp b/src/TableFunctions/TableFunctionObjectStorage.cpp index 9d95cb73877b..9aefc8d27bba 100644 --- a/src/TableFunctions/TableFunctionObjectStorage.cpp +++ b/src/TableFunctions/TableFunctionObjectStorage.cpp @@ -31,6 +31,7 @@ namespace DB namespace Setting { + extern const SettingsBool allow_local_data_lakes; extern const SettingsUInt64 allow_experimental_parallel_reading_from_replicas; extern const SettingsBool parallel_replicas_for_cluster_engines; extern const SettingsString cluster_for_parallel_replicas; @@ -40,6 +41,7 @@ namespace Setting namespace ErrorCodes { extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; + extern const int SUPPORT_IS_DISABLED; } template @@ -79,6 +81,15 @@ std::vector TableFunctionObjectStorage::skipA template void TableFunctionObjectStorage::parseArguments(const ASTPtr & ast_function, ContextPtr context) { + if constexpr (std::is_same_v) + { + if (!context->getSettingsRef()[Setting::allow_local_data_lakes]) + throw Exception( + ErrorCodes::SUPPORT_IS_DISABLED, + "Table function '{}' is disabled. Set `allow_local_data_lakes` to enable it", + Definition::name); + } + /// Clone ast function, because we can modify its arguments like removing headers. auto ast_copy = ast_function->clone(); ASTs & args_func = ast_copy->children; diff --git a/tests/integration/test_storage_iceberg/configs/users.d/users.xml b/tests/integration/test_storage_iceberg/configs/users.d/users.xml index 4b6ba057ecb1..a44aeb904486 100644 --- a/tests/integration/test_storage_iceberg/configs/users.d/users.xml +++ b/tests/integration/test_storage_iceberg/configs/users.d/users.xml @@ -4,6 +4,7 @@ default 1 + 1 From 60ccdb27a19620de30084b1e1c0d749c197a1101 Mon Sep 17 00:00:00 2001 From: Andrey Zvonov Date: Mon, 16 Mar 2026 16:20:18 +0100 Subject: [PATCH 2/4] fix tests --- .../test_storage_iceberg/configs/users.d/users.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_storage_iceberg/configs/users.d/users.xml b/tests/integration/test_storage_iceberg/configs/users.d/users.xml index a44aeb904486..0b9664018a03 100644 --- a/tests/integration/test_storage_iceberg/configs/users.d/users.xml +++ b/tests/integration/test_storage_iceberg/configs/users.d/users.xml @@ -4,7 +4,12 @@ default 1 - 1 + 1 + + + 1 + + From 963eaa74f15b6014487f71894fbae09c5e4e09b6 Mon Sep 17 00:00:00 2001 From: Andrey Zvonov Date: Tue, 17 Mar 2026 12:39:34 +0100 Subject: [PATCH 3/4] fix config --- .../integration/test_storage_iceberg/configs/users.d/users.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_storage_iceberg/configs/users.d/users.xml b/tests/integration/test_storage_iceberg/configs/users.d/users.xml index 0b9664018a03..3d166f3c17af 100644 --- a/tests/integration/test_storage_iceberg/configs/users.d/users.xml +++ b/tests/integration/test_storage_iceberg/configs/users.d/users.xml @@ -4,7 +4,7 @@ default 1 - 1 + 1 From ca041a9f58f76f8fd5b7f8235f0c41badab0de64 Mon Sep 17 00:00:00 2001 From: Andrey Zvonov Date: Wed, 18 Mar 2026 19:17:22 +0100 Subject: [PATCH 4/4] guard properly --- .../TableFunctionObjectStorage.cpp | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/TableFunctions/TableFunctionObjectStorage.cpp b/src/TableFunctions/TableFunctionObjectStorage.cpp index 9aefc8d27bba..63bab552843d 100644 --- a/src/TableFunctions/TableFunctionObjectStorage.cpp +++ b/src/TableFunctions/TableFunctionObjectStorage.cpp @@ -87,7 +87,7 @@ void TableFunctionObjectStorage::parseArguments(const throw Exception( ErrorCodes::SUPPORT_IS_DISABLED, "Table function '{}' is disabled. Set `allow_local_data_lakes` to enable it", - Definition::name); + getName()); } /// Clone ast function, because we can modify its arguments like removing headers. @@ -120,6 +120,15 @@ template ColumnsDescription TableFunctionObjectStorage< Definition, Configuration>::getActualTableStructure(ContextPtr context, bool is_insert_query) const { + if constexpr (std::is_same_v) + { + if (!context->getSettingsRef()[Setting::allow_local_data_lakes]) + throw Exception( + ErrorCodes::SUPPORT_IS_DISABLED, + "Table function '{}' is disabled. Set `allow_local_data_lakes` to enable it", + getName()); + } + if (configuration->structure == "auto") { context->checkAccess(getSourceAccessType()); @@ -140,6 +149,15 @@ StoragePtr TableFunctionObjectStorage::executeImpl( ColumnsDescription cached_columns, bool is_insert_query) const { + if constexpr (std::is_same_v) + { + if (!context->getSettingsRef()[Setting::allow_local_data_lakes]) + throw Exception( + ErrorCodes::SUPPORT_IS_DISABLED, + "Table function '{}' is disabled. Set `allow_local_data_lakes` to enable it", + getName()); + } + chassert(configuration); ColumnsDescription columns; @@ -298,6 +316,10 @@ template class TableFunctionObjectStorage; +#if USE_AVRO +template class TableFunctionObjectStorage; +#endif + #if USE_AVRO && USE_AWS_S3 template class TableFunctionObjectStorage; #endif