提交 be966015 编写于 作者: Z zhang2014 提交者: alexey-milovidov

ISSUES-1369 add check when create Replacing & Collapsing

上级 996eafad
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册