From 60459bbb878bd64726e58faeac9f5a97cacfd26e Mon Sep 17 00:00:00 2001 From: stavrolia Date: Wed, 29 May 2019 20:49:35 +0300 Subject: [PATCH] Yet another fix --- dbms/src/Core/Settings.h | 2 +- dbms/src/Interpreters/InterpreterCreateQuery.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dbms/src/Core/Settings.h b/dbms/src/Core/Settings.h index de668849927..0cd132ef9ed 100644 --- a/dbms/src/Core/Settings.h +++ b/dbms/src/Core/Settings.h @@ -85,7 +85,7 @@ struct Settings : public SettingsCollection M(SettingFloat, totals_auto_threshold, 0.5, "The threshold for totals_mode = 'auto'.") \ \ 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(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") \ diff --git a/dbms/src/Interpreters/InterpreterCreateQuery.cpp b/dbms/src/Interpreters/InterpreterCreateQuery.cpp index f4df8eec703..b6cdf35774f 100644 --- a/dbms/src/Interpreters/InterpreterCreateQuery.cpp +++ b/dbms/src/Interpreters/InterpreterCreateQuery.cpp @@ -526,7 +526,7 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create) /// Set and retrieve list of columns. 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) { 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(name_and_type_pair.type.get())) { 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). " - "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", + 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.", ErrorCodes::SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY); } }