Various fixes [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2017-12-09 17:21:04 +03:00 committed by alexey-milovidov
parent 291467647a
commit 52088c9c07
2 changed files with 6 additions and 0 deletions

View File

@ -98,6 +98,8 @@ public:
if (params.size() == 2)
{
length_to_resize = applyVisitor(FieldVisitorConvertToNumber<UInt64>(), params[1]);
if (length_to_resize > AGGREGATE_FUNCTION_GROUP_ARRAY_INSERT_AT_MAX_SIZE)
throw Exception("Too large array size", ErrorCodes::TOO_LARGE_ARRAY_SIZE);
}
}

View File

@ -72,6 +72,10 @@ public:
throw Exception("Too large parameter for aggregate function " + getName() + ". Maximum: " + toString(TOP_K_MAX_SIZE),
ErrorCodes::ARGUMENT_OUT_OF_BOUND);
if (k == 0)
throw Exception("Parameter 0 is illegal for aggregate function " + getName(),
ErrorCodes::ARGUMENT_OUT_OF_BOUND);
threshold = k;
reserved = TOP_K_LOAD_FACTOR * k;
}