Yet another fix

This commit is contained in:
stavrolia 2019-05-29 20:49:35 +03:00
parent 94e448a65b
commit 60459bbb87
2 changed files with 3 additions and 4 deletions

View File

@ -85,7 +85,7 @@ struct Settings : public SettingsCollection<Settings>
M(SettingFloat, totals_auto_threshold, 0.5, "The threshold for totals_mode = 'auto'.") \ M(SettingFloat, totals_auto_threshold, 0.5, "The threshold for totals_mode = 'auto'.") \
\ \
M(SettingBool, compile, false, "Whether query compilation is enabled.") \ M(SettingBool, compile, false, "Whether query compilation is enabled.") \
M(SettingBool, allow_suspicious_low_cardinality_types, false, "Allows creating table with LowCardinality of types that have fixed size in memory and the size is 8 or less. Allowing it could increase time of merge and memory consumption.") \ M(SettingBool, allow_suspicious_low_cardinality_types, false, "In CREATE TABLE statement allows specifying LowCardinality modifier for types of small fixed size (8 or less). Enabling this may increase merge times and memory consumption.") \
M(SettingBool, compile_expressions, false, "Compile some scalar functions and operators to native code.") \ M(SettingBool, compile_expressions, false, "Compile some scalar functions and operators to native code.") \
M(SettingUInt64, min_count_to_compile, 3, "The number of structurally identical queries before they are compiled.") \ M(SettingUInt64, min_count_to_compile, 3, "The number of structurally identical queries before they are compiled.") \
M(SettingUInt64, min_count_to_compile_expression, 3, "The number of identical expressions before they are JIT-compiled") \ M(SettingUInt64, min_count_to_compile_expression, 3, "The number of identical expressions before they are JIT-compiled") \

View File

@ -526,7 +526,7 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create)
/// Set and retrieve list of columns. /// Set and retrieve list of columns.
ColumnsDescription columns = setColumns(create, as_select_sample, as_storage); ColumnsDescription columns = setColumns(create, as_select_sample, as_storage);
/// Check low cardinality types in creating table if it was not cancelled in setting /// Check low cardinality types in creating table if it was not allowed in setting
if (!create.attach && !context.getSettingsRef().allow_suspicious_low_cardinality_types) if (!create.attach && !context.getSettingsRef().allow_suspicious_low_cardinality_types)
{ {
for (const auto & name_and_type_pair : columns.getAllPhysical()) for (const auto & name_and_type_pair : columns.getAllPhysical())
@ -534,8 +534,7 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create)
if (const auto * current_type_ptr = typeid_cast<const DataTypeLowCardinality *>(name_and_type_pair.type.get())) if (const auto * current_type_ptr = typeid_cast<const DataTypeLowCardinality *>(name_and_type_pair.type.get()))
{ {
if (!isStringOrFixedString(*removeNullable(current_type_ptr->getDictionaryType()))) if (!isStringOrFixedString(*removeNullable(current_type_ptr->getDictionaryType())))
throw Exception("Using type " + current_type_ptr->getDictionaryType()->getName() + " with LowCardinality may negatively affect performance. LowCardinality is only useful for types String, Nullable(String), FixedString and Nullable(FixedString). " throw Exception("Creating columns of type " + current_type_ptr->getName() + " is prohibited by default due to expected negative impact on performance. It can be enabled with the \"allow_suspicious_low_cardinality_types\" setting.",
"If you are sure you want to create a table with this type, you can suppress this error with allow_suspicious_low_cardinality_types setting",
ErrorCodes::SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY); ErrorCodes::SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY);
} }
} }