mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-22 01:30:51 +00:00
ISSUES-1369 add check when create Replacing & Collapsing
This commit is contained in:
parent
996eafada9
commit
be966015c9
@ -276,6 +276,7 @@ void MergeTreeData::MergingParams::check(const NamesAndTypesList & columns) cons
|
||||
if (sign_column.empty())
|
||||
throw Exception("Logical error: Sign column for storage CollapsingMergeTree is empty", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
bool missColumn = true;
|
||||
for (const auto & column : columns)
|
||||
{
|
||||
if (column.name == sign_column)
|
||||
@ -284,9 +285,13 @@ void MergeTreeData::MergingParams::check(const NamesAndTypesList & columns) cons
|
||||
throw Exception("Sign column (" + sign_column + ")"
|
||||
" for storage CollapsingMergeTree must have type Int8."
|
||||
" Provided column of type " + column.type->getName() + ".", ErrorCodes::BAD_TYPE_OF_FIELD);
|
||||
missColumn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(missColumn)
|
||||
throw Exception("Sign column " + sign_column + " does not exist in table declaration.");
|
||||
}
|
||||
else if (!sign_column.empty())
|
||||
throw Exception("Sign column for MergeTree cannot be specified in all modes except Collapsing.", ErrorCodes::LOGICAL_ERROR);
|
||||
@ -311,6 +316,7 @@ void MergeTreeData::MergingParams::check(const NamesAndTypesList & columns) cons
|
||||
throw Exception("Version column for MergeTree cannot be specified in all modes except Replacing.",
|
||||
ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
bool missColumn = true;
|
||||
for (const auto & column : columns)
|
||||
{
|
||||
if (column.name == version_column)
|
||||
@ -324,9 +330,12 @@ void MergeTreeData::MergingParams::check(const NamesAndTypesList & columns) cons
|
||||
throw Exception("Version column (" + version_column + ")"
|
||||
" for storage ReplacingMergeTree must have type of UInt family or Date or DateTime."
|
||||
" Provided column of type " + column.type->getName() + ".", ErrorCodes::BAD_TYPE_OF_FIELD);
|
||||
missColumn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(missColumn)
|
||||
throw Exception("Version column " + version_column + " does not exist in table declaration.");
|
||||
}
|
||||
|
||||
/// TODO Checks for Graphite mode.
|
||||
|
Loading…
Reference in New Issue
Block a user