This is an automated email from the ASF dual-hosted git repository.

starocean999 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 bf340adf5ac [Chore](nereids) Remove AlterDatabaseStmt (#52109)
bf340adf5ac is described below

commit bf340adf5ac11fc36b1f57ce009ecf5576c82ede
Author: yaoxiao <[email protected]>
AuthorDate: Wed Jul 16 16:32:09 2025 +0800

    [Chore](nereids) Remove AlterDatabaseStmt (#52109)
---
 fe/fe-core/src/main/cup/sql_parser.cup             |  20 ---
 .../doris/analysis/AlterDatabasePropertyStmt.java  |  84 ----------
 .../doris/analysis/AlterDatabaseQuotaStmt.java     |  96 -----------
 .../apache/doris/analysis/AlterDatabaseRename.java |  81 ----------
 .../main/java/org/apache/doris/catalog/Env.java    |  15 --
 .../apache/doris/datasource/InternalCatalog.java   |   8 -
 .../commands/AlterDatabasePropertiesCommand.java   |   8 +
 .../main/java/org/apache/doris/qe/DdlExecutor.java |  10 +-
 .../doris/analysis/AlterDatabaseQuotaStmtTest.java | 180 ---------------------
 .../apache/doris/planner/ResourceTagQueryTest.java |  16 +-
 10 files changed, 18 insertions(+), 500 deletions(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 7b2c7fbe219..933faaea226 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -1290,26 +1290,6 @@ alter_stmt ::=
     {:
         RESULT = new AlterTableStmt(tbl, clauses);
     :}
-    | KW_ALTER KW_DATABASE ident:dbName KW_SET KW_DATA KW_QUOTA 
quantity:quota_quantity
-    {:
-        RESULT = new AlterDatabaseQuotaStmt(dbName, QuotaType.DATA, 
quota_quantity);
-    :}
-    | KW_ALTER KW_DATABASE ident:dbName KW_SET KW_REPLICA KW_QUOTA 
INTEGER_LITERAL:number
-    {:
-        RESULT = new AlterDatabaseQuotaStmt(dbName, QuotaType.REPLICA, 
String.valueOf(number));
-    :}
-    | KW_ALTER KW_DATABASE ident:dbName KW_SET KW_TRANSACTION KW_QUOTA 
INTEGER_LITERAL:number
-    {:
-        RESULT = new AlterDatabaseQuotaStmt(dbName, QuotaType.TRANSACTION, 
String.valueOf(number));
-    :}
-    | KW_ALTER KW_DATABASE ident:dbName KW_RENAME ident:newDbName
-    {:
-        RESULT = new AlterDatabaseRename(dbName, newDbName);
-    :}
-    | KW_ALTER KW_DATABASE ident:dbName KW_SET KW_PROPERTIES LPAREN 
key_value_map:map RPAREN
-    {:
-        RESULT = new AlterDatabasePropertyStmt(dbName, map);
-    :}
     | KW_ALTER KW_COLOCATE KW_GROUP colocate_group_name:colocateGroupName 
KW_SET LPAREN key_value_map:properties RPAREN
     {:
         RESULT = new AlterColocateGroupStmt(colocateGroupName, properties);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabasePropertyStmt.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabasePropertyStmt.java
deleted file mode 100644
index 281c60d8cba..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabasePropertyStmt.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.InternalDatabaseUtil;
-import org.apache.doris.common.util.PrintableMap;
-import org.apache.doris.common.util.PropertyAnalyzer;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.base.Strings;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class AlterDatabasePropertyStmt extends DdlStmt implements 
NotFallbackInParser {
-    private String dbName;
-    private Map<String, String> properties;
-
-    public AlterDatabasePropertyStmt(String dbName, Map<String, String> 
properties) {
-        this.dbName = dbName;
-        this.properties = properties;
-    }
-
-    public String getDbName() {
-        return dbName;
-    }
-
-    public Map<String, String> getProperties() {
-        return properties;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        InternalDatabaseUtil.checkDatabase(dbName, ConnectContext.get());
-        if 
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.ADMIN)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_DBACCESS_DENIED_ERROR,
-                    analyzer.getQualifiedUser(), dbName);
-        }
-
-        if (Strings.isNullOrEmpty(dbName)) {
-            ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
-        }
-
-        if (properties == null || properties.isEmpty()) {
-            throw new UserException("Properties is null or empty");
-        }
-
-        // clone properties for analyse
-        Map<String, String> analysisProperties = new HashMap<String, 
String>(properties);
-        PropertyAnalyzer.analyzeBinlogConfig(analysisProperties);
-    }
-
-    @Override
-    public String toSql() {
-        return "ALTER DATABASE " + dbName + " SET PROPERTIES ("
-                + new PrintableMap<String, String>(properties, "=", true, 
false, ",") + ")";
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.ALTER;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java
deleted file mode 100644
index ce607b1d2db..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.alter.QuotaType;
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.InternalDatabaseUtil;
-import org.apache.doris.common.util.ParseUtil;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.base.Strings;
-import com.google.gson.annotations.SerializedName;
-
-public class AlterDatabaseQuotaStmt extends DdlStmt implements 
NotFallbackInParser {
-    @SerializedName("db")
-    private String dbName;
-
-    @SerializedName("qt")
-    private QuotaType quotaType;
-
-    @SerializedName("qv")
-    private String quotaValue;
-
-    @SerializedName("q")
-    private long quota;
-
-    public AlterDatabaseQuotaStmt(String dbName, QuotaType quotaType, String 
quotaValue) {
-        this.dbName = dbName;
-        this.quotaType = quotaType;
-        this.quotaValue = quotaValue;
-    }
-
-    public String getDbName() {
-        return dbName;
-    }
-
-    public long getQuota() {
-        return quota;
-    }
-
-    public QuotaType getQuotaType() {
-        return quotaType;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        InternalDatabaseUtil.checkDatabase(dbName, ConnectContext.get());
-        if 
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.ADMIN)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_DBACCESS_DENIED_ERROR,
-                    analyzer.getQualifiedUser(), dbName);
-        }
-
-        if (Strings.isNullOrEmpty(dbName)) {
-            ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
-        }
-        if (quotaType == QuotaType.DATA) {
-            quota = ParseUtil.analyzeDataVolume(quotaValue);
-        } else if (quotaType == QuotaType.REPLICA) {
-            quota = ParseUtil.analyzeReplicaNumber(quotaValue);
-        } else if (quotaType == QuotaType.TRANSACTION) {
-            quota = ParseUtil.analyzeTransactionNumber(quotaValue);
-        }
-    }
-
-    @Override
-    public String toSql() {
-        return "ALTER DATABASE " + dbName + " SET "
-                + quotaType.name()
-                + " QUOTA " + quotaValue;
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.ALTER;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseRename.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseRename.java
deleted file mode 100644
index fd82d99ec4f..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseRename.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.common.FeNameFormat;
-import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.InternalDatabaseUtil;
-import org.apache.doris.datasource.InternalCatalog;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.base.Strings;
-
-public class AlterDatabaseRename extends DdlStmt implements 
NotFallbackInParser {
-    private String dbName;
-    private String newDbName;
-
-    public AlterDatabaseRename(String dbName, String newDbName) {
-        this.dbName = dbName;
-        this.newDbName = newDbName;
-    }
-
-    public String getDbName() {
-        return dbName;
-    }
-
-    public String getNewDbName() {
-        return newDbName;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws AnalysisException, 
UserException {
-        super.analyze(analyzer);
-        if (Strings.isNullOrEmpty(dbName)) {
-            throw new AnalysisException("Database name is not set");
-        }
-        InternalDatabaseUtil.checkDatabase(dbName, ConnectContext.get());
-        if (!Env.getCurrentEnv().getAccessManager()
-                .checkDbPriv(ConnectContext.get(), 
InternalCatalog.INTERNAL_CATALOG_NAME, dbName,
-                        PrivPredicate.ALTER)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_DBACCESS_DENIED_ERROR,
-                    analyzer.getQualifiedUser(), dbName);
-        }
-
-        if (Strings.isNullOrEmpty(newDbName)) {
-            throw new AnalysisException("New database name is not set");
-        }
-
-        FeNameFormat.checkDbName(newDbName);
-    }
-
-    @Override
-    public String toSql() {
-        return "ALTER DATABASE " + dbName + " RENAME " + newDbName;
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.ALTER;
-    }
-
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index f0c177e684e..ddbe2eaae94 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -27,9 +27,6 @@ import org.apache.doris.alter.SystemHandler;
 import org.apache.doris.analysis.AddPartitionClause;
 import org.apache.doris.analysis.AddPartitionLikeClause;
 import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
-import org.apache.doris.analysis.AlterDatabasePropertyStmt;
-import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
-import org.apache.doris.analysis.AlterDatabaseRename;
 import org.apache.doris.analysis.AlterMultiPartitionClause;
 import org.apache.doris.analysis.AlterTableStmt;
 import org.apache.doris.analysis.AlterViewStmt;
@@ -3444,18 +3441,10 @@ public class Env {
         getInternalCatalog().replayRecoverDatabase(info);
     }
 
-    public void alterDatabaseQuota(AlterDatabaseQuotaStmt stmt) throws 
DdlException {
-        getInternalCatalog().alterDatabaseQuota(stmt.getDbName(), 
stmt.getQuotaType(), stmt.getQuota());
-    }
-
     public void replayAlterDatabaseQuota(String dbName, long quota, QuotaType 
quotaType) throws MetaNotFoundException {
         getInternalCatalog().replayAlterDatabaseQuota(dbName, quota, 
quotaType);
     }
 
-    public void alterDatabaseProperty(AlterDatabasePropertyStmt stmt) throws 
DdlException {
-        getInternalCatalog().alterDatabaseProperty(stmt);
-    }
-
     public void alterDatabaseProperty(String dbName, Map<String, String> 
properties) throws DdlException {
         getInternalCatalog().alterDatabaseProperty(dbName, properties);
     }
@@ -3465,10 +3454,6 @@ public class Env {
         getInternalCatalog().replayAlterDatabaseProperty(dbName, properties);
     }
 
-    public void renameDatabase(AlterDatabaseRename stmt) throws DdlException {
-        getInternalCatalog().renameDatabase(stmt.getDbName(), 
stmt.getNewDbName());
-    }
-
     public void replayRenameDatabase(String dbName, String newDbName) {
         getInternalCatalog().replayRenameDatabase(dbName, newDbName);
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index f5f80b980b0..376e6e4f570 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -22,7 +22,6 @@ import org.apache.doris.analysis.AddPartitionClause;
 import org.apache.doris.analysis.AddPartitionLikeClause;
 import org.apache.doris.analysis.AddRollupClause;
 import org.apache.doris.analysis.AlterClause;
-import org.apache.doris.analysis.AlterDatabasePropertyStmt;
 import org.apache.doris.analysis.AlterMultiPartitionClause;
 import org.apache.doris.analysis.CreateTableStmt;
 import org.apache.doris.analysis.DataSortInfo;
@@ -794,13 +793,6 @@ public class InternalCatalog implements 
CatalogIf<Database> {
         }
     }
 
-    public void alterDatabaseProperty(AlterDatabasePropertyStmt stmt) throws 
DdlException {
-        String dbName = stmt.getDbName();
-        Map<String, String> properties = stmt.getProperties();
-
-        alterDatabaseProperty(dbName, properties);
-    }
-
     public void replayAlterDatabaseProperty(String dbName, Map<String, String> 
properties)
             throws MetaNotFoundException {
         Database db = (Database) getDbOrMetaException(dbName);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterDatabasePropertiesCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterDatabasePropertiesCommand.java
index deadc3cf8e8..a6350ae0d0e 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterDatabasePropertiesCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterDatabasePropertiesCommand.java
@@ -75,6 +75,14 @@ public class AlterDatabasePropertiesCommand extends 
AlterCommand {
         Env.getCurrentEnv().alterDatabaseProperty(dbName, properties);
     }
 
+    public String getDbName() {
+        return dbName;
+    }
+
+    public Map<String, String> getProperties() {
+        return properties;
+    }
+
     @Override
     public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
         return visitor.visitAlterDatabasePropertiesCommand(this, context);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java
index adc3e8506e1..e94afeda976 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java
@@ -19,9 +19,6 @@ package org.apache.doris.qe;
 
 import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
 import org.apache.doris.analysis.AlterColocateGroupStmt;
-import org.apache.doris.analysis.AlterDatabasePropertyStmt;
-import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
-import org.apache.doris.analysis.AlterDatabaseRename;
 import org.apache.doris.analysis.AlterJobStatusStmt;
 import org.apache.doris.analysis.AlterRepositoryStmt;
 import org.apache.doris.analysis.AlterRoleStmt;
@@ -178,10 +175,7 @@ public class DdlExecutor {
             env.getAuth().dropRole((DropRoleStmt) ddlStmt);
         } else if (ddlStmt instanceof SetUserPropertyStmt) {
             env.getAuth().updateUserProperty((SetUserPropertyStmt) ddlStmt);
-        } else if (ddlStmt instanceof AlterDatabaseQuotaStmt) {
-            env.alterDatabaseQuota((AlterDatabaseQuotaStmt) ddlStmt);
-        } else if (ddlStmt instanceof AlterDatabaseRename) {
-            env.renameDatabase((AlterDatabaseRename) ddlStmt);
+
         } else if (ddlStmt instanceof RecoverDbStmt) {
             env.recoverDatabase((RecoverDbStmt) ddlStmt);
         } else if (ddlStmt instanceof RecoverTableStmt) {
@@ -218,8 +212,6 @@ public class DdlExecutor {
             env.getSqlBlockRuleMgr().alterSqlBlockRule((AlterSqlBlockRuleStmt) 
ddlStmt);
         } else if (ddlStmt instanceof DropSqlBlockRuleStmt) {
             env.getSqlBlockRuleMgr().dropSqlBlockRule((DropSqlBlockRuleStmt) 
ddlStmt);
-        } else if (ddlStmt instanceof AlterDatabasePropertyStmt) {
-            env.alterDatabaseProperty((AlterDatabasePropertyStmt) ddlStmt);
         } else if (ddlStmt instanceof RefreshTableStmt) {
             RefreshTableStmt refreshTableStmt = (RefreshTableStmt) ddlStmt;
             
env.getRefreshManager().handleRefreshTable(refreshTableStmt.getCtl(), 
refreshTableStmt.getDbName(),
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterDatabaseQuotaStmtTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterDatabaseQuotaStmtTest.java
deleted file mode 100644
index 745cc95bcec..00000000000
--- 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterDatabaseQuotaStmtTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.alter.QuotaType;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.UserException;
-import org.apache.doris.mysql.privilege.AccessControllerManager;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import mockit.Expectations;
-import mockit.Mocked;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AlterDatabaseQuotaStmtTest {
-    private Analyzer analyzer;
-
-    @Mocked
-    private AccessControllerManager accessManager;
-
-    @Before
-    public void setUp() {
-        analyzer = AccessTestUtil.fetchAdminAnalyzer(false);
-
-        new Expectations() {
-            {
-                accessManager.checkGlobalPriv((ConnectContext) any, 
(PrivPredicate) any);
-                minTimes = 0;
-                result = true;
-
-                accessManager.checkDbPriv((ConnectContext) any, anyString, 
anyString, (PrivPredicate) any);
-                minTimes = 0;
-                result = true;
-
-                accessManager.checkTblPriv((ConnectContext) any, anyString, 
anyString, anyString, (PrivPredicate) any);
-                minTimes = 0;
-                result = true;
-            }
-        };
-    }
-
-    private void testAlterDatabaseDataQuotaStmt(String dbName, String 
quotaQuantity, long quotaSize)
-            throws AnalysisException, UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt(dbName, 
QuotaType.DATA, quotaQuantity);
-        stmt.analyze(analyzer);
-        String expectedSql = "ALTER DATABASE testDb SET DATA QUOTA " + 
quotaQuantity;
-        Assert.assertEquals(expectedSql, stmt.toSql());
-        Assert.assertEquals(quotaSize, stmt.getQuota());
-    }
-
-    @Test
-    public void testNormalAlterDatabaseDataQuotaStmt() throws 
AnalysisException, UserException {
-        // byte
-        testAlterDatabaseDataQuotaStmt("testDb", "102400", 102400L);
-        testAlterDatabaseDataQuotaStmt("testDb", "102400b", 102400L);
-
-        // kb
-        testAlterDatabaseDataQuotaStmt("testDb", "100kb", 100L * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100Kb", 100L * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100KB", 100L * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100K", 100L * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100k", 100L * 1024);
-
-        // mb
-        testAlterDatabaseDataQuotaStmt("testDb", "100mb", 100L * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100Mb", 100L * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100MB", 100L * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100M", 100L * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100m", 100L * 1024 * 1024);
-
-        // gb
-        testAlterDatabaseDataQuotaStmt("testDb", "100gb", 100L * 1024 * 1024 * 
1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100Gb", 100L * 1024 * 1024 * 
1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100GB", 100L * 1024 * 1024 * 
1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100G", 100L * 1024 * 1024 * 
1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100g", 100L * 1024 * 1024 * 
1024);
-
-        // tb
-        testAlterDatabaseDataQuotaStmt("testDb", "100tb", 100L * 1024 * 1024 * 
1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100Tb", 100L * 1024 * 1024 * 
1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100TB", 100L * 1024 * 1024 * 
1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100T", 100L * 1024 * 1024 * 
1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100t", 100L * 1024 * 1024 * 
1024 * 1024);
-
-        // tb
-        testAlterDatabaseDataQuotaStmt("testDb", "100pb", 100L * 1024 * 1024 * 
1024 * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100Pb", 100L * 1024 * 1024 * 
1024 * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100PB", 100L * 1024 * 1024 * 
1024 * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100P", 100L * 1024 * 1024 * 
1024 * 1024 * 1024);
-        testAlterDatabaseDataQuotaStmt("testDb", "100p", 100L * 1024 * 1024 * 
1024 * 1024 * 1024);
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testDataMinusQuota() throws AnalysisException, UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.DATA, "-100mb");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testDataInvalidUnit() throws AnalysisException, UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.DATA, "100invalid_unit");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testDataInvalidQuantity() throws AnalysisException, 
UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.DATA, "invalid_100mb_quota");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-
-    @Test
-    public void testNormalAlterDatabaseReplicaQuotaStmt() throws 
AnalysisException, UserException {
-        long quotaSize = 1000;
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.REPLICA, String.valueOf(quotaSize));
-        stmt.analyze(analyzer);
-        String expectedSql = "ALTER DATABASE testDb SET REPLICA QUOTA 1000";
-        Assert.assertEquals(expectedSql, stmt.toSql());
-        Assert.assertEquals(quotaSize, stmt.getQuota());
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testReplicaMinusQuota() throws AnalysisException, 
UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.REPLICA, "-100");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testReplicaInvalidQuantity() throws AnalysisException, 
UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.REPLICA, "invalid_100_quota");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test
-    public void testNormalAlterDatabaseTransactionQuotaStmt() throws 
AnalysisException, UserException {
-        long quotaSize = 10;
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.TRANSACTION, String.valueOf(quotaSize));
-        stmt.analyze(analyzer);
-        String expectedSql = "ALTER DATABASE testDb SET TRANSACTION QUOTA 10";
-        Assert.assertEquals(expectedSql, stmt.toSql());
-        Assert.assertEquals(quotaSize, stmt.getQuota());
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testTransactionMinusQuota() throws AnalysisException, 
UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.TRANSACTION, "-100");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testtransactionInvalidQuantity() throws AnalysisException, 
UserException {
-        AlterDatabaseQuotaStmt stmt = new AlterDatabaseQuotaStmt("testDb", 
QuotaType.TRANSACTION, "invalid_100_quota");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-}
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java
index 9237fe25d12..d1bcdc13263 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.doris.planner;
 
-import org.apache.doris.analysis.AlterDatabasePropertyStmt;
 import org.apache.doris.analysis.AlterTableStmt;
 import org.apache.doris.analysis.CreateDbStmt;
 import org.apache.doris.analysis.SetUserPropertyStmt;
@@ -38,6 +37,7 @@ import org.apache.doris.common.UserException;
 import org.apache.doris.mysql.privilege.Auth;
 import org.apache.doris.nereids.parser.NereidsParser;
 import org.apache.doris.nereids.trees.plans.PlanType;
+import 
org.apache.doris.nereids.trees.plans.commands.AlterDatabasePropertiesCommand;
 import org.apache.doris.nereids.trees.plans.commands.AlterSystemCommand;
 import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand;
 import org.apache.doris.nereids.trees.plans.commands.info.ModifyBackendOp;
@@ -320,9 +320,11 @@ public class ResourceTagQueryTest {
         //alter db change `replication_allocation`
         String alterDbStmtStr
                 = "alter database test_prop set 
PROPERTIES('replication_allocation' = 'tag.location.default:2');";
-        AlterDatabasePropertyStmt alterDbStmt = (AlterDatabasePropertyStmt) 
UtFrameUtils
-                .parseAndAnalyzeStmt(alterDbStmtStr, connectContext);
-        Env.getCurrentEnv().alterDatabaseProperty(alterDbStmt);
+        NereidsParser nereidsParser = new NereidsParser();
+        AlterDatabasePropertiesCommand alterDatabasePropertiesCommand =
+                (AlterDatabasePropertiesCommand) 
nereidsParser.parseSingle(alterDbStmtStr);
+        
Env.getCurrentEnv().alterDatabaseProperty(alterDatabasePropertiesCommand.getDbName(),
 alterDatabasePropertiesCommand.getProperties());
+
         ExceptionChecker.expectThrowsNoException(() -> 
createTable(createTableStr2));
         Database propDb = 
Env.getCurrentInternalCatalog().getDbNullable("test_prop");
         OlapTable tbl2 = (OlapTable) propDb.getTableNullable("tbl2");
@@ -360,9 +362,9 @@ public class ResourceTagQueryTest {
         Assert.assertTrue(explainString.contains("tablets=2/2"));
         //alter db change `replication_allocation` to null
         alterDbStmtStr = "alter database test_prop set 
PROPERTIES('replication_allocation' = '');";
-        alterDbStmt = (AlterDatabasePropertyStmt) UtFrameUtils
-                .parseAndAnalyzeStmt(alterDbStmtStr, connectContext);
-        Env.getCurrentEnv().alterDatabaseProperty(alterDbStmt);
+        alterDatabasePropertiesCommand =
+                (AlterDatabasePropertiesCommand) 
nereidsParser.parseSingle(alterDbStmtStr);
+        
Env.getCurrentEnv().alterDatabaseProperty(alterDatabasePropertiesCommand.getDbName(),
 alterDatabasePropertiesCommand.getProperties());
         // create table with default tag
         String createTableStr4 = "create table test_prop.tbl4\n"
                 + "(k1 date, k2 int)\n"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to