mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Handle syntax error for ARRAY JOIN with no args
This commit is contained in:
parent
c12f2d460e
commit
241769ee7c
@ -40,13 +40,14 @@ namespace DB
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int EMPTY_NESTED_TABLE;
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int INVALID_JOIN_ON_EXPRESSION;
|
||||
extern const int EMPTY_LIST_OF_COLUMNS_QUERIED;
|
||||
extern const int NOT_IMPLEMENTED;
|
||||
extern const int UNKNOWN_IDENTIFIER;
|
||||
extern const int EMPTY_NESTED_TABLE;
|
||||
extern const int EXPECTED_ALL_OR_ANY;
|
||||
extern const int INVALID_JOIN_ON_EXPRESSION;
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int NOT_IMPLEMENTED;
|
||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
||||
extern const int UNKNOWN_IDENTIFIER;
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -327,6 +328,9 @@ void getArrayJoinedColumns(ASTPtr & query, TreeRewriterResult & result, const AS
|
||||
/// to get the correct number of rows.
|
||||
if (result.array_join_result_to_source.empty())
|
||||
{
|
||||
if (select_query->arrayJoinExpressionList()->children.empty())
|
||||
throw DB::Exception("ARRAY JOIN requires an argument", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
ASTPtr expr = select_query->arrayJoinExpressionList()->children.at(0);
|
||||
String source_name = expr->getColumnName();
|
||||
String result_name = expr->getAliasOrColumnName();
|
||||
|
@ -1 +1,2 @@
|
||||
SELECT x, a FROM (SELECT arrayJoin(['Hello', 'Goodbye']) AS x, [1, 2, 3] AS arr) ARRAY JOIN arr AS a
|
||||
SELECT x, a FROM (SELECT arrayJoin(['Hello', 'Goodbye']) AS x, [1, 2, 3] AS arr) ARRAY JOIN; -- { serverError 42 }
|
||||
SELECT x, a FROM (SELECT arrayJoin(['Hello', 'Goodbye']) AS x, [1, 2, 3] AS arr) ARRAY JOIN arr AS a;
|
||||
|
Loading…
Reference in New Issue
Block a user