Add an experimental setting

This commit is contained in:
Alexey Milovidov 2024-11-10 23:50:31 +01:00
parent 92e8fa23ba
commit 19ab7d484a
4 changed files with 20 additions and 1 deletions

View File

@ -5729,7 +5729,10 @@ Enable experimental functions for natural language processing.
Enable experimental hash functions
)", EXPERIMENTAL) \
DECLARE(Bool, allow_experimental_object_type, false, R"(
Allow Object and JSON data types
Allow the obsolete Object data type
)", EXPERIMENTAL) \
DECLARE(Bool, allow_experimental_bfloat16_type, false, R"(
Allow BFloat16 data type (under development).
)", EXPERIMENTAL) \
DECLARE(Bool, allow_experimental_time_series_table, false, R"(
Allows creation of tables with the [TimeSeries](../../engines/table-engines/integrations/time-series.md) table engine.

View File

@ -77,6 +77,7 @@ static std::initializer_list<std::pair<ClickHouseVersion, SettingsChangesHistory
{"backup_restore_keeper_max_retries_while_handling_error", 0, 20, "New setting."},
{"backup_restore_finish_timeout_after_error_sec", 0, 180, "New setting."},
{"parallel_replicas_local_plan", false, true, "Use local plan for local replica in a query with parallel replicas"},
{"allow_experimental_bfloat16_type", false, false, "Add new experimental BFloat16 type"},
}
},
{"24.10",

View File

@ -20,6 +20,7 @@ namespace Setting
extern const SettingsBool allow_experimental_json_type;
extern const SettingsBool allow_experimental_object_type;
extern const SettingsBool allow_experimental_variant_type;
extern const SettingsBool allow_experimental_bfloat16_type;
extern const SettingsBool allow_suspicious_fixed_string_types;
extern const SettingsBool allow_suspicious_low_cardinality_types;
extern const SettingsBool allow_suspicious_variant_types;
@ -42,6 +43,7 @@ DataTypeValidationSettings::DataTypeValidationSettings(const DB::Settings & sett
, allow_experimental_object_type(settings[Setting::allow_experimental_object_type])
, allow_suspicious_fixed_string_types(settings[Setting::allow_suspicious_fixed_string_types])
, allow_experimental_variant_type(settings[Setting::allow_experimental_variant_type])
, allow_experimental_bfloat16_type(settings[Setting::allow_experimental_bfloat16_type])
, allow_suspicious_variant_types(settings[Setting::allow_suspicious_variant_types])
, validate_nested_types(settings[Setting::validate_experimental_and_suspicious_types_inside_nested_types])
, allow_experimental_dynamic_type(settings[Setting::allow_experimental_dynamic_type])
@ -105,6 +107,18 @@ void validateDataType(const DataTypePtr & type_to_check, const DataTypeValidatio
}
}
if (!settings.allow_experimental_bfloat16_type)
{
if (WhichDataType(data_type).isBFloat16())
{
throw Exception(
ErrorCodes::ILLEGAL_COLUMN,
"Cannot create column with type '{}' because experimental BFloat16 type is not allowed. "
"Set setting allow_experimental_bfloat16_type = 1 in order to allow it",
data_type.getName());
}
}
if (!settings.allow_suspicious_variant_types)
{
if (const auto * variant_type = typeid_cast<const DataTypeVariant *>(&data_type))

View File

@ -20,6 +20,7 @@ struct DataTypeValidationSettings
bool allow_experimental_object_type = true;
bool allow_suspicious_fixed_string_types = true;
bool allow_experimental_variant_type = true;
bool allow_experimental_bfloat16_type = true;
bool allow_suspicious_variant_types = true;
bool validate_nested_types = true;
bool allow_experimental_dynamic_type = true;