add allow_experimental_decimal to settings

This commit is contained in:
chertus 2018-08-14 15:51:45 +03:00
parent 241b05c80a
commit 74823c8c17
5 changed files with 13 additions and 1 deletions

View File

@ -34,6 +34,7 @@
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/NestedUtils.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypesDecimal.h>
#include <Databases/DatabaseFactory.h>
#include <Databases/IDatabase.h>
@ -353,8 +354,9 @@ void InterpreterCreateQuery::checkSupportedTypes(const ColumnsDescription & colu
{
const auto & settings = context.getSettingsRef();
bool allow_low_cardinality = settings.allow_experimental_low_cardinality_type != 0;
bool allow_decimal = settings.allow_experimental_decimal;
if (allow_low_cardinality)
if (allow_low_cardinality && allow_decimal)
return;
auto check_types = [&](const NamesAndTypesList & list)
@ -368,6 +370,12 @@ void InterpreterCreateQuery::checkSupportedTypes(const ColumnsDescription & colu
+ "Set setting allow_experimental_low_cardinality_type = 1 in order to allow it.";
throw Exception(message, ErrorCodes::ILLEGAL_COLUMN);
}
if (!allow_decimal && column.type && isDecimal(*column.type))
{
String message = "Cannot create table with column " + column.name + " which type is " + column.type->getName()
+ ". Set setting allow_experimental_decimal = 1 in order to allow it.";
throw Exception(message, ErrorCodes::ILLEGAL_COLUMN);
}
}
};

View File

@ -272,6 +272,7 @@ 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, allow_experimental_decimal, false, "Enables Decimal data type.") \
\
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(SettingUInt64, max_fetch_partition_retries_count, 5, "Amount of retries while fetching partition from another host.") \

View File

@ -1,3 +1,4 @@
SET allow_experimental_decimal=1;
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS test.decimal;

View File

@ -1,3 +1,4 @@
SET allow_experimental_decimal=1;
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS test.decimal;

View File

@ -1,3 +1,4 @@
SET allow_experimental_decimal=1;
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS test.decimal;