mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Fix
This commit is contained in:
parent
ce99b95230
commit
5103aefd34
@ -100,20 +100,9 @@ bool checkPositionalArguments(ASTPtr & argument, const ASTSelectQuery * select_q
|
||||
{
|
||||
auto columns = select_query->select()->children;
|
||||
|
||||
const auto * group_by_expr_with_alias = dynamic_cast<const ASTWithAlias *>(argument.get());
|
||||
if (group_by_expr_with_alias && !group_by_expr_with_alias->alias.empty())
|
||||
{
|
||||
for (const auto & column : columns)
|
||||
{
|
||||
const auto * col_with_alias = dynamic_cast<const ASTWithAlias *>(column.get());
|
||||
if (col_with_alias)
|
||||
{
|
||||
const auto & alias = col_with_alias->alias;
|
||||
if (!alias.empty() && alias == group_by_expr_with_alias->alias)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
const auto * expr_with_alias = dynamic_cast<const ASTWithAlias *>(argument.get());
|
||||
if (expr_with_alias && !expr_with_alias->alias.empty())
|
||||
return false;
|
||||
|
||||
const auto * ast_literal = typeid_cast<const ASTLiteral *>(argument.get());
|
||||
if (!ast_literal)
|
||||
@ -1324,7 +1313,9 @@ ActionsDAGPtr SelectQueryExpressionAnalyzer::appendOrderBy(ExpressionActionsChai
|
||||
throw Exception("Bad ORDER BY expression AST", ErrorCodes::UNKNOWN_TYPE_OF_AST_NODE);
|
||||
|
||||
if (getContext()->getSettingsRef().enable_positional_arguments)
|
||||
{
|
||||
replaceForPositionalArguments(ast->children.at(0), select_query, ASTSelectQuery::Expression::ORDER_BY);
|
||||
}
|
||||
}
|
||||
|
||||
getRootActions(select_query->orderBy(), only_types, step.actions());
|
||||
|
@ -111,3 +111,7 @@ select substr('aaaaaaaaaaaaaa', 8) as a group by a;
|
||||
aaaaaaa
|
||||
select substr('aaaaaaaaaaaaaa', 8) as a group by substr('aaaaaaaaaaaaaa', 8);
|
||||
aaaaaaa
|
||||
select b from (select 5 as a, 'Hello' as b order by a);
|
||||
Hello
|
||||
select b from (select 5 as a, 'Hello' as b group by a);
|
||||
Hello
|
||||
|
@ -45,3 +45,5 @@ explain syntax select plus(1, 1) as a group by a;
|
||||
select substr('aaaaaaaaaaaaaa', 8) as a group by a;
|
||||
select substr('aaaaaaaaaaaaaa', 8) as a group by substr('aaaaaaaaaaaaaa', 8);
|
||||
|
||||
select b from (select 5 as a, 'Hello' as b order by a);
|
||||
select b from (select 5 as a, 'Hello' as b group by a);
|
||||
|
Loading…
Reference in New Issue
Block a user