This is an automated email from the ASF dual-hosted git repository. morrysnow pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new cc95607a19b [fix](Nereids) delete using should support sql without where (#29518) cc95607a19b is described below commit cc95607a19b81d449bf2298779e47f5c781c369d Author: morrySnow <101034200+morrys...@users.noreply.github.com> AuthorDate: Mon Jan 8 15:13:59 2024 +0800 [fix](Nereids) delete using should support sql without where (#29518) --- fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 | 2 +- .../java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java | 4 ++-- regression-test/suites/delete_p0/test_delete_on_mor.groovy | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) 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 7159350556a..5ce755eb39d 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 @@ -65,7 +65,7 @@ statement | explain? cte? DELETE FROM tableName=multipartIdentifier partitionSpec? tableAlias (USING relation (COMMA relation)*)? - whereClause #delete + whereClause? #delete | LOAD LABEL lableName=identifier LEFT_PAREN dataDescs+=dataDesc (COMMA dataDescs+=dataDesc)* RIGHT_PAREN (withRemoteStorageSystem)? 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 5bfc465b309..f13cc8b69cb 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 @@ -809,12 +809,12 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> { tableAlias = ctx.tableAlias().getText(); } if (ctx.USING() == null && ctx.cte() == null && ctx.explain() == null) { - query = withFilter(query, Optional.of(ctx.whereClause())); + query = withFilter(query, Optional.ofNullable(ctx.whereClause())); return new DeleteFromCommand(tableName, tableAlias, partitionSpec.first, partitionSpec.second, query); } else { // convert to insert into select query = withRelations(query, ctx.relation()); - query = withFilter(query, Optional.of(ctx.whereClause())); + query = withFilter(query, Optional.ofNullable(ctx.whereClause())); Optional<LogicalPlan> cte = Optional.empty(); if (ctx.cte() != null) { cte = Optional.ofNullable(withCte(query, ctx.cte())); diff --git a/regression-test/suites/delete_p0/test_delete_on_mor.groovy b/regression-test/suites/delete_p0/test_delete_on_mor.groovy index 3388356e6e3..71b5b157127 100644 --- a/regression-test/suites/delete_p0/test_delete_on_mor.groovy +++ b/regression-test/suites/delete_p0/test_delete_on_mor.groovy @@ -89,14 +89,14 @@ suite("test_delete_on_mor") { sql "sync;" qt_sql "select * from ${tableA} order by user_id;" - sql """DELETE from ${tableA} USING ${tableA} a - JOIN ( + sql """DELETE from ${tableA} USING + ( SELECT a.user_id, a.city FROM ${tableA} a JOIN ${tableB} ON a.user_id = ${tableB}.user_id AND a.city = ${tableB}.city WHERE ${tableB}.city = '上海' AND ${tableB}.age = 20 ) AS matched_rows - ON ${tableA}.user_id = matched_rows.user_id AND ${tableA}.city = matched_rows.city; """ + WHERE ${tableA}.user_id = matched_rows.user_id AND ${tableA}.city = matched_rows.city; """ qt_sql "select * from ${tableA} order by user_id;" sql "DROP TABLE IF EXISTS ${tableA};" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org