diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 index 0389ac5e09019d1..93a3062ad6e5038 100644 --- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 +++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 @@ -337,6 +337,7 @@ fromClause relation : relationPrimary joinRelation* + | LEFT_PAREN relationPrimary joinRelation* RIGHT_PAREN ; joinRelation @@ -450,6 +451,7 @@ relationPrimary | tvfName=identifier LEFT_PAREN (properties=propertyItemList)? RIGHT_PAREN tableAlias #tableValuedFunction + | LEFT_PAREN relation (COMMA relation)* RIGHT_PAREN #relationList ; materializedViewName diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java index c0e85621e5e49a6..f81edc51ef23188 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java @@ -2241,6 +2241,11 @@ public LogicalPlan visitFromClause(FromClauseContext ctx) { return ParserUtils.withOrigin(ctx, () -> withRelations(null, ctx.relation())); } + @Override + public LogicalPlan visitRelationList(DorisParser.RelationListContext ctx) { + return ParserUtils.withOrigin(ctx, () -> withRelations(null, ctx.relation())); + } + /* ******************************************************************************************** * Table Identifier parsing * ******************************************************************************************** */ diff --git a/regression-test/data/nereids_p0/subquery/test_subquery.out b/regression-test/data/nereids_p0/subquery/test_subquery.out index 004aa0bcad05bf4..a8d6064680d5a27 100644 --- a/regression-test/data/nereids_p0/subquery/test_subquery.out +++ b/regression-test/data/nereids_p0/subquery/test_subquery.out @@ -30,3 +30,6 @@ true 15 1992 3021 11011920 0.000 true 9999-12-12 2015-04-02T00:00 3.141592653 2 1 9 2 \N +-- !select_sub2 -- +9 + diff --git a/regression-test/suites/nereids_p0/subquery/test_subquery.groovy b/regression-test/suites/nereids_p0/subquery/test_subquery.groovy index 36a863a211d3513..aa94e91e8dbb18b 100644 --- a/regression-test/suites/nereids_p0/subquery/test_subquery.groovy +++ b/regression-test/suites/nereids_p0/subquery/test_subquery.groovy @@ -244,6 +244,12 @@ suite("test_subquery") { sql """insert into table_9_undef_undef values (0,3,"his",'g'),(1,8,'p','n'),(2,null,"get","got"),(3,3,'r','r'),(4,null,"or","get"),(5,0,'j',"yeah"),(6,null,'w','x'),(7,8,'q',"for"),(8,3,'p',"that");""" qt_select_sub"""SELECT DISTINCT alias1.`pk` AS field1, alias2.`col_int_undef_signed` AS field2 FROM table_23_undef_undef AS alias1, table_20_undef_undef AS alias2 WHERE ( EXISTS ( SELECT DISTINCT SQ1_alias1.`col_varchar_10__undef_signed` AS SQ1_field1 FROM table_9_undef_undef AS SQ1_alias1 WHERE SQ1_alias1.`col_varchar_10__undef_signed` = alias1.`col_varchar_10__undef_signed` ) ) OR alias1.`col_varchar_1024__undef_signed` = "TmxRwcNZHC" AND ( alias1.`col_varchar_10__undef_signed` <> "rnZeukOcuM" AND alias2.`col_varchar_10__undef_signed` != "dbPAEpzstk" ) ORDER BY alias1.`pk`, field1, field2 LIMIT 2 OFFSET 7; """ + qt_select_sub2 """select count(*) from table_9_undef_undef SQ1_alias1 + LEFT JOIN ( table_20_undef_undef AS SQ1_alias2 RIGHT OUTER + JOIN table_23_undef_undef AS SQ1_alias3 + ON SQ1_alias3.`pk` = SQ1_alias2.`pk` ) + ON SQ1_alias1.`pk` = SQ1_alias2.`pk`;""" + sql """drop table if exists table_23_undef_undef""" sql """drop table if exists table_20_undef_undef""" sql """drop table if exists table_9_undef_undef"""