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 04c3e175268 [Chore](nereids) Remove AlterCatalogStmt (#52108)
04c3e175268 is described below

commit 04c3e175268e232d69265d362ad136ae546f01c9
Author: yaoxiao <[email protected]>
AuthorDate: Wed Jun 25 18:54:53 2025 +0800

    [Chore](nereids) Remove AlterCatalogStmt (#52108)
---
 fe/fe-core/src/main/cup/sql_parser.cup             | 13 ---
 .../doris/analysis/AlterCatalogCommentStmt.java    | 54 ------------
 .../doris/analysis/AlterCatalogNameStmt.java       | 64 --------------
 .../doris/analysis/AlterCatalogPropertyStmt.java   | 62 --------------
 .../apache/doris/analysis/AlterCatalogStmt.java    | 55 ------------
 .../apache/doris/datasource/CatalogFactory.java    | 12 ---
 .../org/apache/doris/datasource/CatalogMgr.java    | 24 ------
 .../main/java/org/apache/doris/qe/DdlExecutor.java |  9 --
 .../doris/analysis/AlterCatalogNameStmtTest.java   | 89 -------------------
 .../doris/analysis/AlterCatalogPropsStmtTest.java  | 99 ----------------------
 10 files changed, 481 deletions(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 15494ae3e92..e687f89b575 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -1374,19 +1374,6 @@ alter_stmt ::=
     {:
         RESULT = new AlterDatabasePropertyStmt(dbName, map);
     :}
-    /* Catalog */
-    | KW_ALTER KW_CATALOG ident:catalogName KW_RENAME ident:newCatalogName
-    {:
-        RESULT = new AlterCatalogNameStmt(catalogName, newCatalogName);
-    :}
-    | KW_ALTER KW_CATALOG ident:catalogName KW_SET KW_PROPERTIES LPAREN 
key_value_map:map RPAREN
-    {:
-        RESULT = new AlterCatalogPropertyStmt(catalogName, map);
-    :}
-    | KW_ALTER KW_CATALOG ident:catalogName KW_MODIFY KW_COMMENT 
STRING_LITERAL:comment
-    {:
-        RESULT = new AlterCatalogCommentStmt(catalogName, comment);
-    :}
     | KW_ALTER KW_RESOURCE ident_or_text:resourceName opt_properties:properties
     {:
         RESULT = new AlterResourceStmt(resourceName, properties);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogCommentStmt.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogCommentStmt.java
deleted file mode 100644
index 279ba1a9ba7..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogCommentStmt.java
+++ /dev/null
@@ -1,54 +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.common.AnalysisException;
-import org.apache.doris.common.UserException;
-
-import com.google.common.base.Strings;
-
-public class AlterCatalogCommentStmt extends AlterCatalogStmt implements 
NotFallbackInParser {
-    private final String comment;
-
-    public AlterCatalogCommentStmt(String catalogName, String comment) {
-        super(catalogName);
-        this.comment = comment;
-    }
-
-    public String getComment() {
-        return comment;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        if (Strings.isNullOrEmpty(comment)) {
-            throw new AnalysisException("New comment is not set.");
-        }
-    }
-
-    @Override
-    public String toSql() {
-        return "ALTER CATALOG " + catalogName + " MODIFY COMMENT " + comment;
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.ALTER;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogNameStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogNameStmt.java
deleted file mode 100644
index c00987deacc..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogNameStmt.java
+++ /dev/null
@@ -1,64 +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.common.AnalysisException;
-import org.apache.doris.common.FeNameFormat;
-import org.apache.doris.common.UserException;
-import org.apache.doris.datasource.InternalCatalog;
-
-import com.google.common.base.Strings;
-
-/**
- * Statement for alter the catalog name.
- */
-public class AlterCatalogNameStmt extends AlterCatalogStmt implements 
NotFallbackInParser {
-    private final String newCatalogName;
-
-    public AlterCatalogNameStmt(String catalogName, String newCatalogName) {
-        super(catalogName);
-        this.newCatalogName = newCatalogName;
-    }
-
-    public String getNewCatalogName() {
-        return newCatalogName;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-
-        if (Strings.isNullOrEmpty(newCatalogName)) {
-            throw new AnalysisException("New catalog name is not set");
-        }
-        if (newCatalogName.equals(InternalCatalog.INTERNAL_CATALOG_NAME)) {
-            throw new AnalysisException("Cannot alter a catalog into a 
build-in name.");
-        }
-        FeNameFormat.checkCommonName("catalog", newCatalogName);
-    }
-
-    @Override
-    public String toSql() {
-        return "ALTER CATALOG " + catalogName + " RENAME " + newCatalogName;
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.ALTER;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogPropertyStmt.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogPropertyStmt.java
deleted file mode 100644
index 8ea73033cd5..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogPropertyStmt.java
+++ /dev/null
@@ -1,62 +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.common.UserException;
-import org.apache.doris.common.util.PrintableMap;
-import org.apache.doris.common.util.PropertyAnalyzer;
-
-import java.util.Map;
-
-/**
- * Statement for alter the catalog property.
- */
-public class AlterCatalogPropertyStmt extends AlterCatalogStmt implements 
NotFallbackInParser {
-    private final Map<String, String> newProperties;
-
-    public AlterCatalogPropertyStmt(String catalogName, Map<String, String> 
newProperties) {
-        super(catalogName);
-        this.newProperties = newProperties;
-    }
-
-    public Map<String, String> getNewProperties() {
-        return newProperties;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        PropertyAnalyzer.checkCatalogProperties(newProperties, true);
-    }
-
-    @Override
-    public String toSql() {
-        return "ALTER CATALOG " + catalogName + " SET PROPERTIES ("
-                + new PrintableMap<>(newProperties, "=", true, false, true) + 
")";
-    }
-
-    @Override
-    public boolean needAuditEncryption() {
-        return true;
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.ALTER;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogStmt.java
deleted file mode 100644
index 98f3f4e690d..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterCatalogStmt.java
+++ /dev/null
@@ -1,55 +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.UserException;
-import org.apache.doris.common.util.Util;
-import org.apache.doris.datasource.InternalCatalog;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-public class AlterCatalogStmt extends DdlStmt {
-    protected final String catalogName;
-
-    public AlterCatalogStmt(String catalogName) {
-        this.catalogName = catalogName;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        Util.checkCatalogAllRules(catalogName);
-        if (!Env.getCurrentEnv().getAccessManager().checkCtlPriv(
-                ConnectContext.get(), catalogName, PrivPredicate.ALTER)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_CATALOG_ACCESS_DENIED,
-                    analyzer.getQualifiedUser(), catalogName);
-        }
-
-        if (catalogName.equals(InternalCatalog.INTERNAL_CATALOG_NAME)) {
-            throw new AnalysisException("Internal catalog can't be alter.");
-        }
-    }
-
-    public String getCatalogName() {
-        return catalogName;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java
index 984d29cae49..558d8b9ae10 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java
@@ -17,9 +17,6 @@
 
 package org.apache.doris.datasource;
 
-import org.apache.doris.analysis.AlterCatalogCommentStmt;
-import org.apache.doris.analysis.AlterCatalogNameStmt;
-import org.apache.doris.analysis.AlterCatalogPropertyStmt;
 import org.apache.doris.analysis.CreateCatalogStmt;
 import org.apache.doris.analysis.DropCatalogStmt;
 import org.apache.doris.analysis.RefreshCatalogStmt;
@@ -58,18 +55,9 @@ public class CatalogFactory {
         CatalogLog log = new CatalogLog();
         if (stmt instanceof DropCatalogStmt) {
             log.setCatalogId(catalogId);
-        } else if (stmt instanceof AlterCatalogPropertyStmt) {
-            log.setCatalogId(catalogId);
-            log.setNewProps(((AlterCatalogPropertyStmt) 
stmt).getNewProperties());
-        } else if (stmt instanceof AlterCatalogNameStmt) {
-            log.setCatalogId(catalogId);
-            log.setNewCatalogName(((AlterCatalogNameStmt) 
stmt).getNewCatalogName());
         } else if (stmt instanceof RefreshCatalogStmt) {
             log.setCatalogId(catalogId);
             log.setInvalidCache(((RefreshCatalogStmt) stmt).isInvalidCache());
-        } else if (stmt instanceof AlterCatalogCommentStmt) {
-            log.setCatalogId(catalogId);
-            log.setComment(((AlterCatalogCommentStmt) stmt).getComment());
         } else {
             throw new RuntimeException("Unknown stmt for catalog manager " + 
stmt.getClass().getSimpleName());
         }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
index 3954921522e..f73839875d5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
@@ -17,9 +17,6 @@
 
 package org.apache.doris.datasource;
 
-import org.apache.doris.analysis.AlterCatalogCommentStmt;
-import org.apache.doris.analysis.AlterCatalogNameStmt;
-import org.apache.doris.analysis.AlterCatalogPropertyStmt;
 import org.apache.doris.analysis.CreateCatalogStmt;
 import org.apache.doris.analysis.DropCatalogStmt;
 import org.apache.doris.analysis.UserIdentity;
@@ -337,13 +334,6 @@ public class CatalogMgr implements Writable, 
GsonPostProcessable {
         }
     }
 
-    /**
-     * Modify the catalog name into a new one and write the meta log.
-     */
-    public void alterCatalogName(AlterCatalogNameStmt stmt) throws 
UserException {
-        alterCatalogName(stmt.getCatalogName(), stmt.getNewCatalogName());
-    }
-
     /**
      * Modify the catalog comment to a new one and write the meta log.
      */
@@ -364,13 +354,6 @@ public class CatalogMgr implements Writable, 
GsonPostProcessable {
         }
     }
 
-    /**
-     * Modify the catalog comment to a new one and write the meta log.
-     */
-    public void alterCatalogComment(AlterCatalogCommentStmt stmt) throws 
UserException {
-        alterCatalogComment(stmt.getCatalogName(), stmt.getComment());
-    }
-
     /**
      * Modify the catalog property and write the meta log.
      */
@@ -396,13 +379,6 @@ public class CatalogMgr implements Writable, 
GsonPostProcessable {
         }
     }
 
-    /**
-     * Modify the catalog property and write the meta log.
-     */
-    public void alterCatalogProps(AlterCatalogPropertyStmt stmt) throws 
UserException {
-        alterCatalogProps(stmt.getCatalogName(), stmt.getNewProperties());
-    }
-
     public List<List<String>> showCatalogs(
             String catalogName, String pattern, String currentCatalogName) 
throws AnalysisException {
         List<List<String>> rows = Lists.newArrayList();
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 e7d139aee77..f52ddee7bc9 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.AdminSetConfigStmt;
 import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
-import org.apache.doris.analysis.AlterCatalogCommentStmt;
-import org.apache.doris.analysis.AlterCatalogNameStmt;
-import org.apache.doris.analysis.AlterCatalogPropertyStmt;
 import org.apache.doris.analysis.AlterColocateGroupStmt;
 import org.apache.doris.analysis.AlterDatabasePropertyStmt;
 import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
@@ -276,12 +273,6 @@ public class DdlExecutor {
             env.getCatalogMgr().createCatalog((CreateCatalogStmt) ddlStmt);
         } else if (ddlStmt instanceof DropCatalogStmt) {
             env.getCatalogMgr().dropCatalog((DropCatalogStmt) ddlStmt);
-        } else if (ddlStmt instanceof AlterCatalogNameStmt) {
-            env.getCatalogMgr().alterCatalogName((AlterCatalogNameStmt) 
ddlStmt);
-        } else if (ddlStmt instanceof AlterCatalogCommentStmt) {
-            env.getCatalogMgr().alterCatalogComment((AlterCatalogCommentStmt) 
ddlStmt);
-        } else if (ddlStmt instanceof AlterCatalogPropertyStmt) {
-            env.getCatalogMgr().alterCatalogProps((AlterCatalogPropertyStmt) 
ddlStmt);
         } else if (ddlStmt instanceof CleanLabelStmt) {
             env.getLoadManager().cleanLabel(((CleanLabelStmt) 
ddlStmt).getDb(), ((CleanLabelStmt) ddlStmt).getLabel());
         } else if (ddlStmt instanceof DropMaterializedViewStmt) {
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterCatalogNameStmtTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterCatalogNameStmtTest.java
deleted file mode 100644
index 5a59ad725b2..00000000000
--- 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterCatalogNameStmtTest.java
+++ /dev/null
@@ -1,89 +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.common.AnalysisException;
-import org.apache.doris.common.DdlException;
-import org.apache.doris.common.UserException;
-import org.apache.doris.datasource.InternalCatalog;
-import org.apache.doris.mysql.privilege.AccessControllerManager;
-import org.apache.doris.mysql.privilege.MockedAuth;
-import org.apache.doris.qe.ConnectContext;
-
-import mockit.Mocked;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AlterCatalogNameStmtTest {
-    private Analyzer analyzer;
-    @Mocked
-    private AccessControllerManager accessManager;
-    @Mocked
-    private ConnectContext ctx;
-
-    @Before
-    public void setUp() throws DdlException {
-        MockedAuth.mockedAccess(accessManager);
-        MockedAuth.mockedConnectContext(ctx, "root", "%");
-        analyzer = AccessTestUtil.fetchAdminAnalyzer(false);
-    }
-
-    @Test
-    public void testNormalCase() throws UserException {
-        AlterCatalogNameStmt stmt = new AlterCatalogNameStmt("testCatalog", 
"testNewCatalog");
-        stmt.analyze(analyzer);
-        Assert.assertEquals("testCatalog", stmt.getCatalogName());
-        Assert.assertEquals("testNewCatalog", stmt.getNewCatalogName());
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testEmptyDs1() throws UserException {
-        AlterCatalogNameStmt stmt = new AlterCatalogNameStmt("", 
"testNewCatalog");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testEmptyDs2() throws UserException {
-        AlterCatalogNameStmt stmt = new AlterCatalogNameStmt("testCatalog", 
"");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testBuildIn1() throws UserException {
-        AlterCatalogNameStmt stmt = new 
AlterCatalogNameStmt(InternalCatalog.INTERNAL_CATALOG_NAME, "testNewCatalog");
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testBuildIn2() throws UserException {
-        AlterCatalogNameStmt stmt = new AlterCatalogNameStmt("testCatalog", 
InternalCatalog.INTERNAL_CATALOG_NAME);
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testNameFormat() throws UserException {
-        AlterCatalogNameStmt stmt = new AlterCatalogNameStmt("testCatalog", 
InternalCatalog.INTERNAL_CATALOG_NAME);
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-}
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterCatalogPropsStmtTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterCatalogPropsStmtTest.java
deleted file mode 100644
index 432086cfa28..00000000000
--- 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AlterCatalogPropsStmtTest.java
+++ /dev/null
@@ -1,99 +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.common.AnalysisException;
-import org.apache.doris.common.DdlException;
-import org.apache.doris.common.UserException;
-import org.apache.doris.datasource.ExternalCatalog;
-import org.apache.doris.datasource.InternalCatalog;
-import org.apache.doris.mysql.privilege.AccessControllerManager;
-import org.apache.doris.mysql.privilege.MockedAuth;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.collect.Maps;
-import mockit.Mocked;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Map;
-
-public class AlterCatalogPropsStmtTest {
-    private Analyzer analyzer;
-    @Mocked
-    private AccessControllerManager accessManager;
-    @Mocked
-    private ConnectContext ctx;
-
-    @Before
-    public void setUp() throws DdlException {
-        MockedAuth.mockedAccess(accessManager);
-        MockedAuth.mockedConnectContext(ctx, "root", "%");
-        analyzer = AccessTestUtil.fetchAdminAnalyzer(false);
-    }
-
-    @Test
-    public void testNormalCase() throws UserException {
-        Map<String, String> props = Maps.newHashMap();
-        props.put("type", "hms");
-        props.put("hive.metastore.uris", "thrift://localhost:9083");
-        AlterCatalogPropertyStmt stmt = new 
AlterCatalogPropertyStmt("testCatalog", props);
-        stmt.analyze(analyzer);
-        Assert.assertEquals("testCatalog", stmt.getCatalogName());
-        Assert.assertEquals(2, stmt.getNewProperties().size());
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testName() throws UserException {
-        Map<String, String> props = Maps.newHashMap();
-        props.put("type", "hms");
-        props.put("hive.metastore.uris", "thrift://localhost:9083");
-        AlterCatalogPropertyStmt stmt = new AlterCatalogPropertyStmt("", 
props);
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testBuildIn() throws UserException {
-        Map<String, String> props = Maps.newHashMap();
-        props.put("type", "hms");
-        props.put("hive.metastore.uris", "thrift://localhost:9083");
-        AlterCatalogPropertyStmt stmt = new 
AlterCatalogPropertyStmt(InternalCatalog.INTERNAL_CATALOG_NAME, props);
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testPropType() throws UserException {
-        Map<String, String> props = Maps.newHashMap();
-        props.put("hive.metastore.uris", "thrift://localhost:9083");
-        AlterCatalogPropertyStmt stmt = new 
AlterCatalogPropertyStmt(InternalCatalog.INTERNAL_CATALOG_NAME, props);
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-
-    @Test(expected = AnalysisException.class)
-    public void testUseMetaCache() throws UserException {
-        Map<String, String> props = Maps.newHashMap();
-        props.put(ExternalCatalog.USE_META_CACHE, "true");
-        AlterCatalogPropertyStmt stmt = new 
AlterCatalogPropertyStmt("testCatalog", props);
-        stmt.analyze(analyzer);
-        Assert.fail("No exception throws.");
-    }
-}


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

Reply via email to