mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
dbms: allowed to type 'count(*)' instead of 'count()' as exception [#METR-2944].
This commit is contained in:
parent
488343c252
commit
b5463a887f
@ -363,10 +363,17 @@ void ExpressionAnalyzer::normalizeTreeImpl(
|
|||||||
replaced = true;
|
replaced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// может быть указано IN t, где t - таблица, что равносильно IN (SELECT * FROM t).
|
/// Может быть указано IN t, где t - таблица, что равносильно IN (SELECT * FROM t).
|
||||||
if (func_node->name == "in" || func_node->name == "notIn" || func_node->name == "globalIn" || func_node->name == "globalNotIn")
|
if (func_node->name == "in" || func_node->name == "notIn" || func_node->name == "globalIn" || func_node->name == "globalNotIn")
|
||||||
if (ASTIdentifier * right = typeid_cast<ASTIdentifier *>(&*func_node->arguments->children.at(1)))
|
if (ASTIdentifier * right = typeid_cast<ASTIdentifier *>(&*func_node->arguments->children.at(1)))
|
||||||
right->kind = ASTIdentifier::Table;
|
right->kind = ASTIdentifier::Table;
|
||||||
|
|
||||||
|
/// А ещё, в качестве исключения, будем понимать count(*) как count(), а не count(список всех столбцов).
|
||||||
|
if (func_node->name == "count" && func_node->arguments->children.size() == 1
|
||||||
|
&& typeid_cast<const ASTAsterisk *>(func_node->arguments->children[0].get()))
|
||||||
|
{
|
||||||
|
func_node->arguments->children.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (ASTIdentifier * node = typeid_cast<ASTIdentifier *>(&*ast))
|
else if (ASTIdentifier * node = typeid_cast<ASTIdentifier *>(&*ast))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user