Merge pull request #58220 from wangtZJU/fix_AddDefaultDatabaseVisitor_bad_performance

fix CREATE VIEW hang
This commit is contained in:
Alexey Milovidov 2023-12-27 13:30:37 +01:00 committed by GitHub
commit d0bc4fafdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 7 deletions

View File

@ -148,8 +148,6 @@ private:
{
if (table_expression.database_and_table_name)
tryVisit<ASTTableIdentifier>(table_expression.database_and_table_name);
else if (table_expression.subquery)
tryVisit<ASTSubquery>(table_expression.subquery);
}
void visit(const ASTTableIdentifier & identifier, ASTPtr & ast) const
@ -167,11 +165,6 @@ private:
ast = qualified_identifier;
}
void visit(ASTSubquery & subquery, ASTPtr &) const
{
tryVisit<ASTSelectWithUnionQuery>(subquery.children[0]);
}
void visit(ASTFunction & function, ASTPtr &) const
{
bool is_operator_in = functionIsInOrGlobalInOperator(function.name);

View File

@ -0,0 +1,44 @@
drop view if exists slow_view1;
create view slow_view1 as
with c1 as (select 1 as a),
c2 as (select a from c1),
c3 as (select a from c2),
c4 as (select a from c3),
c5 as (select a from c4),
c6 as (select a from c5),
c7 as (select a from c6),
c8 as (select a from c7),
c9 as (select a from c8),
c10 as (select a from c9),
c11 as (select a from c10),
c12 as (select a from c11),
c13 as (select a from c12),
c14 as (select a from c13),
c15 as (select a from c14),
c16 as (select a from c15),
c17 as (select a from c16),
c18 as (select a from c17),
c19 as (select a from c18),
c20 as (select a from c19),
c21 as (select a from c20),
c22 as (select a from c21),
c23 as (select a from c22),
c24 as (select a from c23),
c25 as (select a from c24),
c26 as (select a from c25),
c27 as (select a from c26),
c28 as (select a from c27),
c29 as (select a from c28),
c30 as (select a from c29),
c31 as (select a from c30),
c32 as (select a from c31),
c33 as (select a from c32),
c34 as (select a from c33),
c35 as (select a from c34),
c36 as (select a from c35),
c37 as (select a from c36),
c38 as (select a from c37),
c39 as (select a from c38),
c40 as (select a from c39)
select a from c21;