mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Fix
This commit is contained in:
parent
10362c28bf
commit
7f9ddcf2ea
@ -26,6 +26,7 @@ namespace ErrorCodes
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
||||
}
|
||||
|
||||
std::vector<size_t> TableFunctionExecutable::skipAnalysisForArguments(const QueryTreeNodePtr & query_node_table_function, ContextPtr) const
|
||||
@ -61,10 +62,17 @@ void TableFunctionExecutable::parseArguments(const ASTPtr & ast_function, Contex
|
||||
"Table function '{}' requires minimum 3 arguments: script_name, format, structure, [input_query...]",
|
||||
getName());
|
||||
|
||||
if (args[2]->as<ASTSetQuery>())
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||
"Table function '{}' requires 3 mandatory arguments: script_name, format, structure",
|
||||
getName());
|
||||
auto check_argument = [&](size_t i, const std::string & argument_name)
|
||||
{
|
||||
if (!args[i]->as<ASTIdentifier>() && !args[i]->as<ASTLiteral>() && !args[i]->as<ASTQueryParameter>())
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type of argument '{}' for table function '{}': must be an identifier or string literal",
|
||||
argument_name, getName());
|
||||
};
|
||||
|
||||
check_argument(0, "script_name");
|
||||
check_argument(1, "format");
|
||||
check_argument(2, "structure");
|
||||
|
||||
for (size_t i = 0; i <= 2; ++i)
|
||||
args[i] = evaluateConstantExpressionOrIdentifierAsLiteral(args[i], context);
|
||||
|
@ -5,5 +5,5 @@ SELECT '--------------------';
|
||||
EXPLAIN SYNTAX SELECT * from executable('', 'JSON', 'data String', SETTINGS max_command_execution_time=100, command_read_timeout=1);
|
||||
SELECT '--------------------';
|
||||
|
||||
SELECT * from executable('JSON', 'data String', SETTINGS max_command_execution_time=100); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT * from executable('JSON', 'data String', SETTINGS max_command_execution_time=100); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||
SELECT * from executable('JSON', 'data String', 'TEST', 'TEST'); -- { serverError BAD_ARGUMENTS }
|
||||
|
Loading…
Reference in New Issue
Block a user