mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 01:00:48 +00:00
Add a MergeTree setting: allow_floating_point_partition_key
This commit is contained in:
parent
a47e177b3e
commit
e6c9361559
@ -114,6 +114,7 @@ struct Settings;
|
||||
/** Obsolete settings. Kept for backward compatibility only. */ \
|
||||
M(UInt64, min_relative_delay_to_yield_leadership, 120, "Obsolete setting, does nothing.", 0) \
|
||||
M(UInt64, check_delay_period, 60, "Obsolete setting, does nothing.", 0) \
|
||||
M(Bool, allow_floating_point_partition_key, false, "Allow floating point as partition key", 0) \
|
||||
/// Settings that should not change after the creation of a table.
|
||||
#define APPLY_FOR_IMMUTABLE_MERGE_TREE_SETTINGS(M) \
|
||||
M(index_granularity)
|
||||
|
@ -719,7 +719,7 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
||||
}
|
||||
|
||||
DataTypes data_types = metadata.partition_key.data_types;
|
||||
if (!args.attach)
|
||||
if (!args.attach && !storage_settings->allow_floating_point_partition_key)
|
||||
{
|
||||
for (size_t i = 0; i < data_types.size(); ++i)
|
||||
if (isFloat(data_types[i]))
|
||||
|
@ -1,3 +1,7 @@
|
||||
DROP TABLE IF EXISTS test;
|
||||
CREATE TABLE test (a Float32, b int) Engine = MergeTree() ORDER BY tuple() PARTITION BY a; -- { serverError 36 }
|
||||
CREATE TABLE test (a Float32, b int, c String, d Float64) Engine = MergeTree() ORDER BY tuple() PARTITION BY (b, c, d); -- { serverError 36 }
|
||||
CREATE TABLE test (a Float32, b int) Engine = MergeTree() ORDER BY tuple() PARTITION BY a settings allow_floating_point_partition_key=true;
|
||||
DROP TABLE IF EXISTS test;
|
||||
CREATE TABLE test (a Float32, b int, c String, d Float64) Engine = MergeTree() ORDER BY tuple() PARTITION BY (b, c, d) settings allow_floating_point_partition_key=false; -- { serverError 36 }
|
||||
CREATE TABLE test (a Float32, b int, c String, d Float64) Engine = MergeTree() ORDER BY tuple() PARTITION BY (b, c, d) settings allow_floating_point_partition_key=true;
|
||||
DROP TABLE IF EXISTS test;
|
||||
|
Loading…
Reference in New Issue
Block a user