提交 65b1d524 编写于 作者: M Michael Kolupaev

clickhouse: fixed column names that look like functions [#CONV-7444].

上级 80edc8d7
......@@ -304,12 +304,26 @@ void ExpressionAnalyzer::normalizeTreeImpl(ASTPtr & ast, MapOfASTs & finished_as
ASTPtr initial_ast = ast;
current_asts.insert(initial_ast);
/// Действия, выполняемые сверху вниз.
/// rewrite правила, которые действуют при обходе сверху-вниз.
if (!sign_column_name.empty())
considerSignRewrite(ast);
if (ASTIdentifier * node = dynamic_cast<ASTIdentifier *>(&*ast))
if (ASTFunction * node = dynamic_cast<ASTFunction *>(&*ast))
{
/** Нет ли в таблице столбца, название которого полностью совпадает с записью функции?
* Например, в таблице есть столбец "domain(URL)", и мы запросили domain(URL).
*/
String function_string = node->getColumnName();
NamesAndTypesList::const_iterator it = findColumn(function_string);
if (columns.end() != it)
{
ASTIdentifier * ast_id = new ASTIdentifier(node->range, std::string(node->range.first, node->range.second));
ast = ast_id;
current_asts.insert(ast);
}
}
else if (ASTIdentifier * node = dynamic_cast<ASTIdentifier *>(&*ast))
{
if (node->kind == ASTIdentifier::Column)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册