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 46a58f84c857477..e3513f89734a580 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 @@ -54,8 +54,7 @@ statementBase | constraintStatement #constraintStatementAlias | supportedDropStatement #supportedDropStatementAlias | supportedSetStatement #supportedSetStatementAlias - | supportedUnsetVariableStatement #supportedUnsetVariableStatementAlias - | supportedUnsetDefaultStorageVaultStatement #supportedUnsetDefaultStorageVaultStatementAlias + | supportedUnsetStatement #supportedUnsetStatementAlias | unsupportedStatement #unsupported ; @@ -840,12 +839,9 @@ isolationLevel : ISOLATION LEVEL ((READ UNCOMMITTED) | (READ COMMITTED) | (REPEATABLE READ) | (SERIALIZABLE)) ; -supportedUnsetVariableStatement +supportedUnsetStatement : UNSET (GLOBAL | SESSION | LOCAL)? VARIABLE (ALL | identifier) - ; - -supportedUnsetDefaultStorageVaultStatement - : UNSET DEFAULT STORAGE VAULT + | UNSET DEFAULT STORAGE VAULT ; unsupportedUseStatement 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 bd39d2e010c47e7..ddd191b0f46a1f2 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 @@ -205,8 +205,7 @@ import org.apache.doris.nereids.DorisParser.StructLiteralContext; import org.apache.doris.nereids.DorisParser.SubqueryContext; import org.apache.doris.nereids.DorisParser.SubqueryExpressionContext; -import org.apache.doris.nereids.DorisParser.SupportedUnsetDefaultStorageVaultStatementContext; -import org.apache.doris.nereids.DorisParser.SupportedUnsetVariableStatementContext; +import org.apache.doris.nereids.DorisParser.SupportedUnsetStatementContext; import org.apache.doris.nereids.DorisParser.SystemVariableContext; import org.apache.doris.nereids.DorisParser.TableAliasContext; import org.apache.doris.nereids.DorisParser.TableNameContext; @@ -3828,7 +3827,10 @@ public Object visitUnsupported(UnsupportedContext ctx) { } @Override - public LogicalPlan visitSupportedUnsetVariableStatement(SupportedUnsetVariableStatementContext ctx) { + public LogicalPlan visitSupportedUnsetStatement(SupportedUnsetStatementContext ctx) { + if (ctx.DEFAULT() != null && ctx.STORAGE() != null && ctx.VAULT() != null) { + return new UnsetDefaultStorageVaultCommand(); + } SetType type = SetType.DEFAULT; if (ctx.GLOBAL() != null) { type = SetType.GLOBAL; @@ -3843,12 +3845,6 @@ public LogicalPlan visitSupportedUnsetVariableStatement(SupportedUnsetVariableSt throw new AnalysisException("Should add 'ALL' or variable name"); } - @Override - public LogicalPlan visitSupportedUnsetDefaultStorageVaultStatement( - SupportedUnsetDefaultStorageVaultStatementContext ctx) { - return new UnsetDefaultStorageVaultCommand(); - } - @Override public LogicalPlan visitCreateTableLike(CreateTableLikeContext ctx) { List nameParts = visitMultipartIdentifier(ctx.name); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UnsetVariableCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UnsetVariableCommand.java index 2f9aa3822ea759e..48af3a43769a164 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UnsetVariableCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UnsetVariableCommand.java @@ -46,7 +46,7 @@ public class UnsetVariableCommand extends Command implements Forward { private SetType setType; - // variables to restore + // variable to restore private String variable = null; private boolean applyToAll = false;