From 0eee4d42cb97a134f852215f5c2a4329bd176839 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 10 Feb 2019 00:55:51 +0300 Subject: [PATCH] LowCardinality data type is production ready --- .../Interpreters/InterpreterCreateQuery.cpp | 31 ------------------- .../src/Interpreters/InterpreterCreateQuery.h | 2 -- dbms/src/Interpreters/Settings.h | 1 - 3 files changed, 34 deletions(-) diff --git a/dbms/src/Interpreters/InterpreterCreateQuery.cpp b/dbms/src/Interpreters/InterpreterCreateQuery.cpp index 112f7332221..39cce79303c 100644 --- a/dbms/src/Interpreters/InterpreterCreateQuery.cpp +++ b/dbms/src/Interpreters/InterpreterCreateQuery.cpp @@ -429,33 +429,6 @@ ColumnsDescription InterpreterCreateQuery::getColumnsDescription(const ASTExpres } -void InterpreterCreateQuery::checkSupportedTypes(const ColumnsDescription & columns, const Context & context) -{ - const auto & settings = context.getSettingsRef(); - bool allow_low_cardinality = settings.allow_experimental_low_cardinality_type != 0; - - if (allow_low_cardinality) - return; - - auto check_types = [&](const NamesAndTypesList & list) - { - for (const auto & column : list) - { - if (!allow_low_cardinality && column.type && column.type->lowCardinality()) - { - String message = "Cannot create table with column '" + column.name + "' which type is '" - + column.type->getName() + "' because LowCardinality type is not allowed. " - + "Set setting allow_experimental_low_cardinality_type = 1 in order to allow it."; - throw Exception(message, ErrorCodes::ILLEGAL_COLUMN); - } - } - }; - - check_types(columns.ordinary); - check_types(columns.materialized); -} - - ColumnsDescription InterpreterCreateQuery::setColumns( ASTCreateQuery & create, const Block & as_select_sample, const StoragePtr & as_storage) const { @@ -618,10 +591,6 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create) /// Set and retrieve list of columns. ColumnsDescription columns = setColumns(create, as_select_sample, as_storage); - /// Some column types may be not allowed according to settings. - if (!create.attach) - checkSupportedTypes(columns, context); - /// Set the table engine if it was not specified explicitly. setEngine(create); diff --git a/dbms/src/Interpreters/InterpreterCreateQuery.h b/dbms/src/Interpreters/InterpreterCreateQuery.h index aa9c02df8a5..2f124e7df9b 100644 --- a/dbms/src/Interpreters/InterpreterCreateQuery.h +++ b/dbms/src/Interpreters/InterpreterCreateQuery.h @@ -49,8 +49,6 @@ public: /// Obtain information about columns, their types, default values and column comments, for case when columns in CREATE query is specified explicitly. static ColumnsDescription getColumnsDescription(const ASTExpressionList & columns, const Context & context); - /// Check that column types are allowed for usage in table according to settings. - static void checkSupportedTypes(const ColumnsDescription & columns, const Context & context); private: BlockIO createDatabase(ASTCreateQuery & create); diff --git a/dbms/src/Interpreters/Settings.h b/dbms/src/Interpreters/Settings.h index fdeba24b92e..227e81970c0 100644 --- a/dbms/src/Interpreters/Settings.h +++ b/dbms/src/Interpreters/Settings.h @@ -284,7 +284,6 @@ struct Settings \ M(SettingUInt64, low_cardinality_max_dictionary_size, 8192, "Maximum size (in rows) of shared global dictionary for LowCardinality type.") \ M(SettingBool, low_cardinality_use_single_dictionary_for_part, false, "LowCardinality type serialization setting. If is true, than will use additional keys when global dictionary overflows. Otherwise, will create several shared dictionaries.") \ - M(SettingBool, allow_experimental_low_cardinality_type, false, "Allows to create table with LowCardinality types.") \ M(SettingBool, decimal_check_overflow, true, "Check overflow of decimal arithmetic/comparison operations") \ \ M(SettingBool, prefer_localhost_replica, 1, "1 - always send query to local replica, if it exists. 0 - choose replica to send query between local and remote ones according to load_balancing") \