mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
LowCardinality data type is production ready
This commit is contained in:
parent
9650c4a0da
commit
0eee4d42cb
@ -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(
|
ColumnsDescription InterpreterCreateQuery::setColumns(
|
||||||
ASTCreateQuery & create, const Block & as_select_sample, const StoragePtr & as_storage) const
|
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.
|
/// Set and retrieve list of columns.
|
||||||
ColumnsDescription columns = setColumns(create, as_select_sample, as_storage);
|
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.
|
/// Set the table engine if it was not specified explicitly.
|
||||||
setEngine(create);
|
setEngine(create);
|
||||||
|
|
||||||
|
@ -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.
|
/// 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);
|
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:
|
private:
|
||||||
BlockIO createDatabase(ASTCreateQuery & create);
|
BlockIO createDatabase(ASTCreateQuery & create);
|
||||||
|
@ -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(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, 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, 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") \
|
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") \
|
||||||
|
Loading…
Reference in New Issue
Block a user