mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Added requested change [#CLICKHOUSE-2191].
This commit is contained in:
parent
06d1509da1
commit
a106520a0d
@ -52,6 +52,7 @@ namespace ErrorCodes
|
||||
extern const int UNKNOWN_IDENTIFIER;
|
||||
extern const int FUNCTION_CANNOT_HAVE_PARAMETERS;
|
||||
extern const int TYPE_MISMATCH;
|
||||
extern const int INCORRECT_NUMBER_OF_COLUMNS;
|
||||
}
|
||||
|
||||
|
||||
@ -473,14 +474,14 @@ StoragePtr StorageFactory::get(
|
||||
auto sharding_expr = ExpressionAnalyzer(sharding_key, context, nullptr, *columns).getActions(false);
|
||||
const Block & block = sharding_expr->getSampleBlock();
|
||||
|
||||
if (block.columns() != 0)
|
||||
{
|
||||
auto type = block.getColumns().back().type;
|
||||
if (block.columns() != 1)
|
||||
throw Exception("Sharding expression must return exactly one column", ErrorCodes::INCORRECT_NUMBER_OF_COLUMNS);
|
||||
|
||||
if (!type->isNumeric())
|
||||
throw Exception("Sharding expression has type " + type->getName() +
|
||||
", but should be one of integer type", ErrorCodes::TYPE_MISMATCH);
|
||||
}
|
||||
auto type = block.getByPosition(0).type;
|
||||
|
||||
if (!type->isNumeric())
|
||||
throw Exception("Sharding expression has type " + type->getName() +
|
||||
", but should be one of integer type", ErrorCodes::TYPE_MISMATCH);
|
||||
}
|
||||
|
||||
return StorageDistributed::create(
|
||||
|
Loading…
Reference in New Issue
Block a user