fixed ASTInterpolateElement::clone, fixed QueryNormalizer to exclude ASTInterpolateElement::children

This commit is contained in:
Yakov Olkhovskiy 2022-04-07 17:41:05 -04:00
parent 7dbe8bc2dc
commit 64dcddc6e3
4 changed files with 6 additions and 4 deletions

View File

@ -888,7 +888,7 @@ static InterpolateDescriptionPtr getInterpolateDescription(
col_set.insert(column.name);
}
for (const auto & column : result_block)
if( col_set.count(column.name) == 0)
if (col_set.count(column.name) == 0)
source_columns.emplace_back(column.name, column.type);
}

View File

@ -9,6 +9,7 @@
#include <Parsers/ASTSelectQuery.h>
#include <Parsers/ASTQueryParameter.h>
#include <Parsers/ASTTablesInSelectQuery.h>
#include <Parsers/ASTInterpolateElement.h>
#include <Common/StringUtils/StringUtils.h>
#include <Common/quoteString.h>
#include <IO/WriteHelpers.h>
@ -134,7 +135,7 @@ void QueryNormalizer::visit(ASTTablesInSelectQueryElement & node, const ASTPtr &
static bool needVisitChild(const ASTPtr & child)
{
return !(child->as<ASTSelectQuery>() || child->as<ASTTableExpression>());
return !(child->as<ASTSelectQuery>() || child->as<ASTTableExpression>() || child->as<ASTInterpolateElement>());
}
/// special visitChildren() for ASTSelectQuery

View File

@ -47,7 +47,7 @@ bool RequiredSourceColumnsMatcher::needChildVisit(const ASTPtr & node, const AST
return false;
/// Processed. Do not need children.
if (node->as<ASTTableExpression>() || node->as<ASTArrayJoin>() || node->as<ASTSelectQuery>())
if (node->as<ASTTableExpression>() || node->as<ASTArrayJoin>() || node->as<ASTSelectQuery>() || node->as<ASTInterpolateElement>())
return false;
if (const auto * f = node->as<ASTFunction>())

View File

@ -17,8 +17,9 @@ public:
ASTPtr clone() const override
{
auto clone = std::make_shared<ASTInterpolateElement>(*this);
clone->cloneChildren();
clone->expr = clone->expr->clone();
clone->children.clear();
clone->children.push_back(clone->expr);
return clone;
}