Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Core/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
\
/* ####################################################### */ \
Expand Down
4 changes: 4 additions & 0 deletions src/Core/SettingsChangesHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/Storages/ObjectStorage/registerStorageObjectStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<StorageLocalIcebergConfiguration>();
return createStorageObjectStorage(args, configuration);
},
Expand Down
33 changes: 33 additions & 0 deletions src/TableFunctions/TableFunctionObjectStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,6 +41,7 @@ namespace Setting
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
extern const int SUPPORT_IS_DISABLED;
}

template <typename Definition, typename Configuration>
Expand Down Expand Up @@ -79,6 +81,15 @@ std::vector<size_t> TableFunctionObjectStorage<Definition, Configuration>::skipA
template <typename Definition, typename Configuration>
void TableFunctionObjectStorage<Definition, Configuration>::parseArguments(const ASTPtr & ast_function, ContextPtr context)
{
if constexpr (std::is_same_v<Definition, IcebergLocalDefinition>)
{
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());
}

/// Clone ast function, because we can modify its arguments like removing headers.
auto ast_copy = ast_function->clone();
ASTs & args_func = ast_copy->children;
Expand Down Expand Up @@ -109,6 +120,15 @@ template <typename Definition, typename Configuration>
ColumnsDescription TableFunctionObjectStorage<
Definition, Configuration>::getActualTableStructure(ContextPtr context, bool is_insert_query) const
{
if constexpr (std::is_same_v<Definition, IcebergLocalDefinition>)
{
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());
Expand All @@ -129,6 +149,15 @@ StoragePtr TableFunctionObjectStorage<Definition, Configuration>::executeImpl(
ColumnsDescription cached_columns,
bool is_insert_query) const
{
if constexpr (std::is_same_v<Definition, IcebergLocalDefinition>)
{
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;

Expand Down Expand Up @@ -287,6 +316,10 @@ template class TableFunctionObjectStorage<HDFSClusterDefinition, StorageHDFSConf
#endif
template class TableFunctionObjectStorage<LocalDefinition, StorageLocalConfiguration>;

#if USE_AVRO
template class TableFunctionObjectStorage<IcebergLocalDefinition, StorageLocalIcebergConfiguration>;
#endif

#if USE_AVRO && USE_AWS_S3
template class TableFunctionObjectStorage<IcebergS3ClusterDefinition, StorageS3IcebergConfiguration>;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<password></password>
<profile>default</profile>
<named_collection_control>1</named_collection_control>
<allow_local_data_lakes>1</allow_local_data_lakes>
</default>
</users>
<profiles>
<default>
<allow_local_data_lakes>1</allow_local_data_lakes>
</default>
</profiles>
</clickhouse>
Loading