mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge pull request #62413 from Avogar/fix-numbers-zero-step
Fix logical error 'numbers_storage.step != UInt64{0}'
This commit is contained in:
commit
6c952ce0f1
@ -20,6 +20,7 @@ namespace ErrorCodes
|
||||
{
|
||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
||||
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -78,6 +79,9 @@ StoragePtr TableFunctionNumbers<multithreaded>::executeImpl(
|
||||
UInt64 length = arguments.size() >= 2 ? evaluateArgument(context, arguments[1]) : evaluateArgument(context, arguments[0]);
|
||||
UInt64 step = arguments.size() == 3 ? evaluateArgument(context, arguments[2]) : 1;
|
||||
|
||||
if (!step)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Table function {} requires step to be a positive number", getName());
|
||||
|
||||
auto res = std::make_shared<StorageSystemNumbers>(
|
||||
StorageID(getDatabaseName(), table_name), multithreaded, std::string{"number"}, length, offset, step);
|
||||
res->startup();
|
||||
|
@ -0,0 +1,2 @@
|
||||
select * from numbers(1, 10, 0); -- {serverError BAD_ARGUMENTS}
|
||||
|
Loading…
Reference in New Issue
Block a user