mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
Suppport Zero-argument variants for table functions zeros, zeros_mt
This commit is contained in:
parent
1ae8a9fc6f
commit
a00ec8e6ed
@ -55,15 +55,24 @@ StoragePtr TableFunctionZeros<multithreaded>::executeImpl(const ASTPtr & ast_fun
|
||||
{
|
||||
auto arguments = function->arguments->children;
|
||||
|
||||
if (arguments.size() != 1)
|
||||
if (arguments.size() >= 2)
|
||||
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Table function '{}' requires 'length'.", getName());
|
||||
|
||||
if (arguments.size() == 1)
|
||||
{
|
||||
UInt64 length = evaluateArgument(context, arguments[0]);
|
||||
|
||||
UInt64 length = evaluateArgument(context, arguments[0]);
|
||||
|
||||
auto res = std::make_shared<StorageSystemZeros>(StorageID(getDatabaseName(), table_name), multithreaded, length);
|
||||
res->startup();
|
||||
return res;
|
||||
auto res = std::make_shared<StorageSystemZeros>(StorageID(getDatabaseName(), table_name), multithreaded, length);
|
||||
res->startup();
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// zero-argument, the same as system.zeros
|
||||
auto res = std::make_shared<StorageSystemZeros>(StorageID(getDatabaseName(), table_name), multithreaded);
|
||||
res->startup();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Table function '{}' requires 'limit'.", getName());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user