mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-23 10:10:50 +00:00
Fixed error with analyzing double-distributed subqueries [#METR-23472].
This commit is contained in:
parent
52390b0180
commit
eb1ae65eda
@ -73,9 +73,9 @@ bool isQueryFromTable(const ASTSelectQuery & query)
|
||||
|
||||
if (query_table)
|
||||
{
|
||||
if (typeid_cast<const ASTSelectQuery *>(query_table.get()) != nullptr)
|
||||
if (typeid_cast<const ASTSelectQuery *>(query_table.get()))
|
||||
return false;
|
||||
else if (typeid_cast<const ASTFunction *>(query_table.get()) != nullptr)
|
||||
else if (typeid_cast<const ASTFunction *>(query_table.get()))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
@ -166,11 +166,7 @@ public:
|
||||
auto node = to_preprocess.back();
|
||||
to_preprocess.pop_back();
|
||||
|
||||
ASTFunction * function;
|
||||
ASTTableJoin * join;
|
||||
ASTSelectQuery * sub_select_query;
|
||||
|
||||
if ((function = typeid_cast<ASTFunction *>(node)) != nullptr)
|
||||
if (ASTFunction * function = typeid_cast<ASTFunction *>(node))
|
||||
{
|
||||
auto attributes = getAttributesFromInSubqueryName(function->name);
|
||||
if (attributes != 0)
|
||||
@ -180,25 +176,30 @@ public:
|
||||
node->attributes |= attributes;
|
||||
}
|
||||
}
|
||||
else if ((join = typeid_cast<ASTTableJoin *>(node)) != nullptr)
|
||||
else if (ASTTablesInSelectQueryElement * join = typeid_cast<ASTTablesInSelectQueryElement *>(node))
|
||||
{
|
||||
if (join->table_join)
|
||||
{
|
||||
/// Найдена секция JOIN.
|
||||
node->enclosing_in_or_join = node;
|
||||
node->attributes |= IAST::IsJoin;
|
||||
if (join->locality == ASTTableJoin::Locality::Global)
|
||||
node->attributes |= IAST::IsGlobal;
|
||||
join->enclosing_in_or_join = join->table_join.get();
|
||||
join->table_join->attributes |= IAST::IsJoin;
|
||||
if (static_cast<const ASTTableJoin &>(*join->table_join).locality == ASTTableJoin::Locality::Global)
|
||||
join->table_join->attributes |= IAST::IsGlobal;
|
||||
}
|
||||
else if ((node != static_cast<IAST *>(select_query))
|
||||
&& ((sub_select_query = typeid_cast<ASTSelectQuery *>(node)) != nullptr))
|
||||
}
|
||||
else if (node != static_cast<IAST *>(select_query))
|
||||
{
|
||||
if (ASTSelectQuery * sub_select_query = typeid_cast<ASTSelectQuery *>(node))
|
||||
{
|
||||
++node->select_query_depth;
|
||||
|
||||
if (sub_select_query->enclosing_in_or_join != nullptr)
|
||||
if (sub_select_query->enclosing_in_or_join)
|
||||
{
|
||||
/// Найден подзапрос внутри секции IN или JOIN.
|
||||
preprocessSubquery(*sub_select_query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(node->attributes & IAST::IsPreprocessedForInJoinSubqueries))
|
||||
{
|
||||
|
@ -1148,7 +1148,6 @@ bool performTests(const TestEntries & entries)
|
||||
if (res.first)
|
||||
{
|
||||
++count;
|
||||
std::cout << "Test " << i << " passed.\n";
|
||||
}
|
||||
else
|
||||
std::cout << "Test " << i << " at line " << entry.line_num << " failed.\n"
|
||||
|
Loading…
Reference in New Issue
Block a user