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 7a8297318d3 [Chore](nereids) Remove CreateCatalogStmt (#54389)
7a8297318d3 is described below
commit 7a8297318d34b8924790c221420d7cdfd9d9ae5b
Author: csding <[email protected]>
AuthorDate: Thu Aug 7 10:45:22 2025 +0800
[Chore](nereids) Remove CreateCatalogStmt (#54389)
---
fe/fe-core/src/main/cup/sql_parser.cup | 11 +-
.../apache/doris/analysis/CreateCatalogStmt.java | 129 ---------------------
.../apache/doris/datasource/CatalogFactory.java | 10 --
.../org/apache/doris/datasource/CatalogMgr.java | 10 --
.../main/java/org/apache/doris/qe/DdlExecutor.java | 3 -
.../org/apache/doris/catalog/RefreshDbTest.java | 15 ++-
.../org/apache/doris/catalog/RefreshTableTest.java | 14 ++-
.../apache/doris/datasource/ColumnPrivTest.java | 54 ++++-----
.../doris/datasource/ExternalCatalogTest.java | 80 +++++++------
.../doris/datasource/RefreshCatalogTest.java | 35 +++---
.../datasource/hive/HiveDDLAndDMLPlanTest.java | 13 ++-
.../datasource/iceberg/CreateIcebergTableTest.java | 6 +-
...bleNameComparedLowercaseMetaCacheFalseTest.java | 24 ++--
...ableNameComparedLowercaseMetaCacheTrueTest.java | 24 ++--
...TableNameStoredLowercaseMetaCacheFalseTest.java | 24 ++--
...lTableNameStoredLowercaseMetaCacheTrueTest.java | 24 ++--
.../datasource/property/PropertyConverterTest.java | 121 +++++++++++++------
.../apache/doris/external/hms/HmsCatalogTest.java | 18 ++-
.../org/apache/doris/qe/HmsQueryCacheTest.java | 17 ++-
.../apache/doris/utframe/TestWithFeService.java | 9 +-
20 files changed, 302 insertions(+), 339 deletions(-)
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup
b/fe/fe-core/src/main/cup/sql_parser.cup
index 1602b1fe880..9230ad7d99a 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -1627,17 +1627,8 @@ opt_intermediate_type ::=
// Create Statement
create_stmt ::=
- /* Catalog */
- KW_CREATE KW_CATALOG opt_if_not_exists:ifNotExists ident:catalogName
opt_comment:comment opt_properties:properties
- {:
- RESULT = new CreateCatalogStmt(ifNotExists, catalogName, null,
properties, comment);
- :}
- | KW_CREATE KW_CATALOG opt_if_not_exists:ifNotExists ident:catalogName
KW_WITH KW_RESOURCE ident:resourceName opt_comment:comment
opt_properties:properties
- {:
- RESULT = new CreateCatalogStmt(ifNotExists, catalogName,
resourceName, properties, comment);
- :}
/* Table */
- | KW_CREATE opt_external:isExternal KW_TABLE opt_if_not_exists:ifNotExists
table_name:name KW_LIKE table_name:existed_name KW_WITH KW_ROLLUP LPAREN
ident_list:rollupNames RPAREN
+ KW_CREATE opt_external:isExternal KW_TABLE opt_if_not_exists:ifNotExists
table_name:name KW_LIKE table_name:existed_name KW_WITH KW_ROLLUP LPAREN
ident_list:rollupNames RPAREN
{:
RESULT = new CreateTableLikeStmt(ifNotExists, name, existed_name,
rollupNames, false);
:}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateCatalogStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateCatalogStmt.java
deleted file mode 100644
index 00e1893592c..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateCatalogStmt.java
+++ /dev/null
@@ -1,129 +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.Config;
-import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.PrintableMap;
-import org.apache.doris.common.util.PropertyAnalyzer;
-import org.apache.doris.common.util.Util;
-import org.apache.doris.datasource.ExternalCatalog;
-import org.apache.doris.datasource.InternalCatalog;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Maps;
-
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.Map;
-
-/**
- * Statement for create a new catalog.
- */
-public class CreateCatalogStmt extends DdlStmt implements NotFallbackInParser {
- private final boolean ifNotExists;
- private final String catalogName;
- private final String resource;
- private final String comment;
- private final Map<String, String> properties;
-
- /**
- * Statement for create a new catalog.
- */
- public CreateCatalogStmt(boolean ifNotExists, String catalogName, String
resource, Map<String, String> properties,
- String comment) {
- this.ifNotExists = ifNotExists;
- this.catalogName = catalogName;
- this.resource = Strings.nullToEmpty(resource);
- this.comment = Strings.nullToEmpty(comment);
- this.properties = properties == null ? Maps.newHashMap() : properties;
- }
-
- public String getCatalogName() {
- return catalogName;
- }
-
- public String getResource() {
- return resource;
- }
-
- public String getComment() {
- return comment;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public boolean isSetIfNotExists() {
- return ifNotExists;
- }
-
- @Override
- public void analyze() throws UserException {
- super.analyze();
- Util.checkCatalogAllRules(catalogName);
- if (catalogName.equals(InternalCatalog.INTERNAL_CATALOG_NAME)) {
- throw new AnalysisException("Internal catalog name can't be
create.");
- }
-
- if (Config.disallow_create_catalog_with_resource &&
!Strings.isNullOrEmpty(resource)) {
- throw new AnalysisException("Create catalog with resource is
deprecated and is not allowed."
- + " You can set
`disallow_create_catalog_with_resource=false` in fe.conf"
- + " to enable it temporarily.");
- }
-
- String currentDateTime =
LocalDateTime.now(ZoneId.systemDefault()).toString().replace("T", " ");
- properties.put(ExternalCatalog.CREATE_TIME, currentDateTime);
- PropertyAnalyzer.checkCatalogProperties(properties, false);
- }
-
- @Override
- public String toString() {
- return toSql();
- }
-
- @Override
- public String toSql() {
- StringBuilder stringBuilder = new StringBuilder();
- stringBuilder.append("CREATE CATALOG
").append("`").append(catalogName).append("`");
- if (!Strings.isNullOrEmpty(resource)) {
- stringBuilder.append(" WITH RESOURCE
`").append(resource).append("`");
- }
- if (!Strings.isNullOrEmpty(comment)) {
- stringBuilder.append("\nCOMMENT \"").append(comment).append("\"");
- }
- if (properties.size() > 0) {
- stringBuilder.append("\nPROPERTIES (\n");
- stringBuilder.append(new PrintableMap<>(properties, "=", true,
true, true));
- stringBuilder.append("\n)");
- }
- return stringBuilder.toString();
- }
-
- @Override
- public boolean needAuditEncryption() {
- return true;
- }
-
- @Override
- public StmtType stmtType() {
- return StmtType.CREATE;
- }
-}
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 f7f1d5047a6..d401929d7d1 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,7 +17,6 @@
package org.apache.doris.datasource;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.Resource;
import org.apache.doris.common.DdlException;
@@ -62,15 +61,6 @@ public class CatalogFactory {
cmd.getComment(), cmd.getProperties(), false);
}
- /**
- * create the catalog instance from creating statement.
- */
- public static CatalogIf createFromStmt(long catalogId, CreateCatalogStmt
stmt)
- throws DdlException {
- return createCatalog(catalogId, stmt.getCatalogName(),
stmt.getResource(),
- stmt.getComment(), stmt.getProperties(), false);
- }
-
private static CatalogIf createCatalog(long catalogId, String name, String
resource, String comment,
Map<String, String> props, boolean isReplay) throws DdlException {
// get catalog type from resource or properties
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 f4b2d4cc816..79a2fba4084 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,7 +17,6 @@
package org.apache.doris.datasource;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.DatabaseIf;
@@ -250,15 +249,6 @@ public class CatalogMgr implements Writable,
GsonPostProcessable {
createCatalogImpl(catalog, cmd.getCatalogName(),
cmd.isSetIfNotExists());
}
- /**
- * Create and hold the catalog instance and write the meta log.
- */
- public void createCatalog(CreateCatalogStmt stmt) throws UserException {
- long id = Env.getCurrentEnv().getNextId();
- CatalogIf catalog = CatalogFactory.createFromStmt(id, stmt);
- createCatalogImpl(catalog, stmt.getCatalogName(),
stmt.isSetIfNotExists());
- }
-
/**
* Remove the catalog instance by name and write the meta log.
*/
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 e7daee7bc39..b19be5aa9c6 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
@@ -28,7 +28,6 @@ import org.apache.doris.analysis.AlterWorkloadSchedPolicyStmt;
import org.apache.doris.analysis.CancelExportStmt;
import org.apache.doris.analysis.CancelLoadStmt;
import org.apache.doris.analysis.CopyStmt;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.CreateEncryptKeyStmt;
import org.apache.doris.analysis.CreateIndexPolicyStmt;
import org.apache.doris.analysis.CreateJobStmt;
@@ -175,8 +174,6 @@ public class DdlExecutor {
env.getIndexPolicyMgr().createIndexPolicy((CreateIndexPolicyStmt)
ddlStmt);
} else if (ddlStmt instanceof DropIndexPolicyStmt) {
env.getIndexPolicyMgr().dropIndexPolicy((DropIndexPolicyStmt)
ddlStmt);
- } else if (ddlStmt instanceof CreateCatalogStmt) {
- env.getCatalogMgr().createCatalog((CreateCatalogStmt) ddlStmt);
} else if (ddlStmt instanceof DropCatalogStmt) {
env.getCatalogMgr().dropCatalog((DropCatalogStmt) ddlStmt);
} else if (ddlStmt instanceof RefreshCatalogStmt) {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshDbTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshDbTest.java
index 52a67aa96fa..f60ef70b588 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshDbTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshDbTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.catalog;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.RefreshDbStmt;
import org.apache.doris.analysis.UserIdentity;
@@ -31,6 +30,7 @@ import org.apache.doris.datasource.test.TestExternalDatabase;
import org.apache.doris.datasource.test.TestExternalTable;
import org.apache.doris.mysql.privilege.Auth;
import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateUserCommand;
import
org.apache.doris.nereids.trees.plans.commands.GrantTablePrivilegeCommand;
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
@@ -56,14 +56,19 @@ public class RefreshDbTest extends TestWithFeService {
FeConstants.runningUnitTest = true;
rootCtx = createDefaultCtx();
env = Env.getCurrentEnv();
+
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt("create catalog test1 properties(\n"
+ String createStmt = "create catalog test1 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.catalog.RefreshTableTest$RefreshTableProvider\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Override
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshTableTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshTableTest.java
index da152a02d34..73b55ef3b0f 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshTableTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/RefreshTableTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.catalog;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.RefreshTableStmt;
import org.apache.doris.analysis.TableName;
@@ -34,6 +33,7 @@ import org.apache.doris.datasource.test.TestExternalCatalog;
import org.apache.doris.datasource.test.TestExternalTable;
import org.apache.doris.mysql.privilege.Auth;
import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateUserCommand;
import
org.apache.doris.nereids.trees.plans.commands.GrantTablePrivilegeCommand;
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
@@ -60,13 +60,17 @@ public class RefreshTableTest extends TestWithFeService {
rootCtx = createDefaultCtx();
env = Env.getCurrentEnv();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt("create catalog test1 properties(\n"
+ String createStmt = "create catalog test1 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.catalog.RefreshTableTest$RefreshTableProvider\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Override
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/ColumnPrivTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/ColumnPrivTest.java
index dd8dd925151..cfa97e4e16b 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/datasource/ColumnPrivTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/datasource/ColumnPrivTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.CreateTableStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.UserIdentity;
@@ -25,6 +24,7 @@ import org.apache.doris.catalog.Env;
import org.apache.doris.common.FeConstants;
import org.apache.doris.mysql.privilege.Auth;
import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateDatabaseCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateUserCommand;
import
org.apache.doris.nereids.trees.plans.commands.GrantTablePrivilegeCommand;
@@ -57,34 +57,36 @@ public class ColumnPrivTest extends TestWithFeService {
auth = env.getAuth();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt(
- "create catalog test1 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.ColumnPrivTest$MockedCatalogProvider\",\n"
- + " \"access_controller.class\" "
- + "=
\"org.apache.doris.datasource.ColumnPrivTest$TestAccessControllerFactory\",\n"
- + " \"access_controller.properties.key1\" =
\"val1\",\n"
- + " \"access_controller.properties.key2\" =
\"val2\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
-
- CreateCatalogStmt testCatalog2 = (CreateCatalogStmt)
parseAndAnalyzeStmt(
- "create catalog test2 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.ColumnPrivTest$MockedCatalogProvider\",\n"
- + " \"access_controller.properties.key1\" =
\"val1\",\n"
- + " \"access_controller.properties.key2\" =
\"val2\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog2);
+ String createStmt = "create catalog test1 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.ColumnPrivTest$MockedCatalogProvider\",\n"
+ + " \"access_controller.class\" "
+ + "=
\"org.apache.doris.datasource.ColumnPrivTest$TestAccessControllerFactory\",\n"
+ + " \"access_controller.properties.key1\" = \"val1\",\n"
+ + " \"access_controller.properties.key2\" = \"val2\"\n"
+ + ");";
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
+
+ createStmt = "create catalog test2 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.ColumnPrivTest$MockedCatalogProvider\",\n"
+ + " \"access_controller.properties.key1\" = \"val1\",\n"
+ + " \"access_controller.properties.key2\" = \"val2\"\n"
+ + ");";
+ logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
// 2. create internal db and tbl
String createDbStmtStr = "create database innerdb1";
- NereidsParser nereidsParser = new NereidsParser();
- LogicalPlan logicalPlan = nereidsParser.parseSingle(createDbStmtStr);
+ logicalPlan = nereidsParser.parseSingle(createDbStmtStr);
StmtExecutor stmtExecutor = new StmtExecutor(connectContext,
createDbStmtStr);
if (logicalPlan instanceof CreateDatabaseCommand) {
((CreateDatabaseCommand) logicalPlan).run(connectContext,
stmtExecutor);
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/ExternalCatalogTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/ExternalCatalogTest.java
index aafdeffcaa1..a86e9324809 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/ExternalCatalogTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/ExternalCatalogTest.java
@@ -17,13 +17,15 @@
package org.apache.doris.datasource;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.PrimitiveType;
import org.apache.doris.common.FeConstants;
import org.apache.doris.datasource.hive.HMSExternalCatalog;
import org.apache.doris.datasource.test.TestExternalCatalog;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.QueryState.MysqlStateType;
import org.apache.doris.qe.StmtExecutor;
@@ -50,71 +52,79 @@ public class ExternalCatalogTest extends TestWithFeService {
rootCtx = createDefaultCtx();
env = Env.getCurrentEnv();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt(
- "create catalog test1 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\",\n"
- + " \"include_database_list\" = \"db1\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ String createStmt = "create catalog test1 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\",\n"
+ + " \"include_database_list\" = \"db1\"\n"
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
- testCatalog = (CreateCatalogStmt) parseAndAnalyzeStmt(
- "create catalog test2 properties(\n"
+ createStmt = "create catalog test2 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\",\n"
+ " \"exclude_database_list\" = \"db1\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+ logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
- testCatalog = (CreateCatalogStmt) parseAndAnalyzeStmt(
- "create catalog test3 properties(\n"
+ createStmt = "create catalog test3 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\",\n"
+ " \"include_database_list\" = \"db1\",\n"
+ " \"exclude_database_list\" = \"db1\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+ logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
// use_meta_cache=false
- testCatalog = (CreateCatalogStmt) parseAndAnalyzeStmt(
- "create catalog test4 properties(\n"
+ createStmt = "create catalog test4 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"use_meta_cache\" = \"false\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\",\n"
+ " \"include_database_list\" = \"db1\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+ logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
- testCatalog = (CreateCatalogStmt) parseAndAnalyzeStmt(
- "create catalog test5 properties(\n"
+ createStmt = "create catalog test5 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"use_meta_cache\" = \"false\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\",\n"
+ " \"exclude_database_list\" = \"db1\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+ logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
- testCatalog = (CreateCatalogStmt) parseAndAnalyzeStmt(
- "create catalog test6 properties(\n"
+ createStmt = "create catalog test6 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"use_meta_cache\" = \"false\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\",\n"
+ " \"include_database_list\" = \"db1\",\n"
+ " \"exclude_database_list\" = \"db1\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+ logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Test
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/RefreshCatalogTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/RefreshCatalogTest.java
index ac642f009b6..6c62bbb8999 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/RefreshCatalogTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/RefreshCatalogTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.RefreshCatalogStmt;
import org.apache.doris.catalog.Column;
@@ -33,6 +32,9 @@ import org.apache.doris.datasource.test.TestExternalCatalog;
import org.apache.doris.datasource.test.TestExternalDatabase;
import org.apache.doris.datasource.test.TestExternalTable;
import org.apache.doris.mysql.privilege.Auth;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.persist.gson.GsonUtils;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.DdlExecutor;
@@ -60,24 +62,29 @@ public class RefreshCatalogTest extends TestWithFeService {
env = Env.getCurrentEnv();
auth = env.getAuth();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt(
- "create catalog test1 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"metadata_refresh_interval_sec\" = \"1\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ String createStmt = "create catalog test1 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"metadata_refresh_interval_sec\" = \"1\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider\"\n"
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
// 2. create test2 catalog
- testCatalog = (CreateCatalogStmt) parseAndAnalyzeStmt("create catalog
test2 properties(\n"
+ createStmt = "create catalog test2 properties(\n"
+ " \"type\" = \"test\",\n"
+ " \"catalog_provider.class\" "
+ "=
\"org.apache.doris.datasource.RefreshCatalogTest$RefreshCatalogProvider2\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ + ");";
+ logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Override
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/hive/HiveDDLAndDMLPlanTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/hive/HiveDDLAndDMLPlanTest.java
index 7d1e5df7526..0cecfa1c5d5 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/hive/HiveDDLAndDMLPlanTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/hive/HiveDDLAndDMLPlanTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource.hive;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DbName;
import org.apache.doris.analysis.HashDistributionDesc;
import org.apache.doris.analysis.SwitchStmt;
@@ -39,6 +38,7 @@ import
org.apache.doris.nereids.properties.DistributionSpecHiveTableSinkUnPartit
import org.apache.doris.nereids.properties.PhysicalProperties;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.PlanType;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateDatabaseCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand;
import org.apache.doris.nereids.trees.plans.commands.DropDatabaseCommand;
@@ -113,10 +113,15 @@ public class HiveDDLAndDMLPlanTest extends
TestWithFeService {
createTable(createSourceInterPTable, true);
// create external catalog and switch it
- CreateCatalogStmt hiveCatalog = createStmt("create catalog " +
mockedCtlName
+ String hiveCatalog = "create catalog " + mockedCtlName
+ " properties('type' = 'hms',"
- + " 'hive.metastore.uris' = 'thrift://192.168.0.1:9083');");
- Env.getCurrentEnv().getCatalogMgr().createCatalog(hiveCatalog);
+ + " 'hive.metastore.uris' = 'thrift://192.168.0.1:9083');";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(hiveCatalog);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
switchHive();
// create db and use it
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
index e967c799170..c5c7155ce62 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/CreateIcebergTableTest.java
@@ -17,11 +17,11 @@
package org.apache.doris.datasource.iceberg;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.UserException;
import org.apache.doris.datasource.CatalogFactory;
import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand;
import org.apache.doris.nereids.trees.plans.commands.info.CreateTableInfo;
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
@@ -64,8 +64,8 @@ public class CreateIcebergTableTest {
param.put("warehouse", warehouse);
// create catalog
- CreateCatalogStmt createCatalogStmt = new CreateCatalogStmt(true,
"iceberg", "", param, "comment");
- icebergCatalog = (IcebergHadoopExternalCatalog)
CatalogFactory.createFromStmt(1, createCatalogStmt);
+ CreateCatalogCommand createCatalogCommand = new
CreateCatalogCommand("iceberg", true, "", "comment", param);
+ icebergCatalog = (IcebergHadoopExternalCatalog)
CatalogFactory.createFromCommand(1, createCatalogCommand);
if (icebergCatalog.getUseMetaCache().get()) {
icebergCatalog.makeSureInitialized();
} else {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheFalseTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheFalseTest.java
index e470cebbeec..59fbb18bdb2 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheFalseTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheFalseTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource.lowercase;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.RefreshCatalogStmt;
import org.apache.doris.analysis.SwitchStmt;
@@ -29,6 +28,9 @@ import org.apache.doris.catalog.SchemaTable;
import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.datasource.test.TestExternalCatalog;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.DdlExecutor;
import org.apache.doris.qe.GlobalVariable;
@@ -52,14 +54,18 @@ public class
ExternalTableNameComparedLowercaseMetaCacheFalseTest extends TestWi
rootCtx = createDefaultCtx();
env = Env.getCurrentEnv();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt("create catalog test1 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"use_meta_cache\" = \"false\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameComparedLowercaseMetaCacheFalseTest$ExternalTableNameComparedLowercaseProvider\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ String createStmt = "create catalog test1 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"use_meta_cache\" = \"false\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameComparedLowercaseMetaCacheFalseTest$ExternalTableNameComparedLowercaseProvider\"\n"
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Override
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheTrueTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheTrueTest.java
index ade73f3fef2..fe15617d275 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheTrueTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameComparedLowercaseMetaCacheTrueTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource.lowercase;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.RefreshCatalogStmt;
import org.apache.doris.analysis.SwitchStmt;
@@ -27,6 +26,9 @@ import org.apache.doris.catalog.PrimitiveType;
import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.datasource.test.TestExternalCatalog;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.DdlExecutor;
import org.apache.doris.qe.GlobalVariable;
@@ -50,14 +52,18 @@ public class
ExternalTableNameComparedLowercaseMetaCacheTrueTest extends TestWit
rootCtx = createDefaultCtx();
env = Env.getCurrentEnv();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt("create catalog test1 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"use_meta_cache\" = \"true\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameComparedLowercaseMetaCacheTrueTest$ExternalTableNameComparedLowercaseProvider\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ String createStmt = "create catalog test1 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"use_meta_cache\" = \"true\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameComparedLowercaseMetaCacheTrueTest$ExternalTableNameComparedLowercaseProvider\"\n"
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Override
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheFalseTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheFalseTest.java
index c4e1fee1768..0cad2b281a5 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheFalseTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheFalseTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource.lowercase;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.RefreshCatalogStmt;
import org.apache.doris.analysis.SwitchStmt;
@@ -27,6 +26,9 @@ import org.apache.doris.catalog.PrimitiveType;
import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.datasource.test.TestExternalCatalog;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.DdlExecutor;
import org.apache.doris.qe.GlobalVariable;
@@ -50,14 +52,18 @@ public class
ExternalTableNameStoredLowercaseMetaCacheFalseTest extends TestWith
rootCtx = createDefaultCtx();
env = Env.getCurrentEnv();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt("create catalog test1 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"use_meta_cache\" = \"false\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameStoredLowercaseMetaCacheFalseTest$ExternalTableNameStoredLowercaseProvider\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ String createStmt = "create catalog test1 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"use_meta_cache\" = \"false\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameStoredLowercaseMetaCacheFalseTest$ExternalTableNameStoredLowercaseProvider\"\n"
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Override
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheTrueTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheTrueTest.java
index d3eca35debb..e8b52e16350 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheTrueTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/lowercase/ExternalTableNameStoredLowercaseMetaCacheTrueTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource.lowercase;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.analysis.RefreshCatalogStmt;
import org.apache.doris.analysis.SwitchStmt;
@@ -27,6 +26,9 @@ import org.apache.doris.catalog.PrimitiveType;
import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.datasource.test.TestExternalCatalog;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.DdlExecutor;
import org.apache.doris.qe.GlobalVariable;
@@ -50,14 +52,18 @@ public class
ExternalTableNameStoredLowercaseMetaCacheTrueTest extends TestWithF
rootCtx = createDefaultCtx();
env = Env.getCurrentEnv();
// 1. create test catalog
- CreateCatalogStmt testCatalog = (CreateCatalogStmt)
parseAndAnalyzeStmt("create catalog test1 properties(\n"
- + " \"type\" = \"test\",\n"
- + " \"use_meta_cache\" = \"true\",\n"
- + " \"catalog_provider.class\" "
- + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameStoredLowercaseMetaCacheTrueTest$ExternalTableNameStoredLowercaseProvider\"\n"
- + ");",
- rootCtx);
- env.getCatalogMgr().createCatalog(testCatalog);
+ String createStmt = "create catalog test1 properties(\n"
+ + " \"type\" = \"test\",\n"
+ + " \"use_meta_cache\" = \"true\",\n"
+ + " \"catalog_provider.class\" "
+ + "=
\"org.apache.doris.datasource.lowercase.ExternalTableNameStoredLowercaseMetaCacheTrueTest$ExternalTableNameStoredLowercaseProvider\"\n"
+ + ");";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(rootCtx, null);
+ }
}
@Override
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
index 54e95d49f34..9539420e9b1 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.datasource.property;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.DropCatalogStmt;
import org.apache.doris.backup.Repository;
import org.apache.doris.catalog.Env;
@@ -25,7 +24,6 @@ import org.apache.doris.catalog.Resource;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.FeMetaVersion;
-import org.apache.doris.common.UserException;
import org.apache.doris.common.util.PrintableMap;
import org.apache.doris.datasource.ExternalCatalog;
import org.apache.doris.datasource.hive.HMSExternalCatalog;
@@ -43,6 +41,7 @@ import
org.apache.doris.datasource.property.constants.OssProperties;
import org.apache.doris.datasource.property.constants.S3Properties;
import org.apache.doris.meta.MetaContext;
import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateRepositoryCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateResourceCommand;
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
@@ -189,8 +188,14 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'AWS_ACCESS_KEY' = 'akk',\n"
+ " 'AWS_SECRET_KEY' = 'skk'\n"
+ ");";
- CreateCatalogStmt analyzedStmt = createStmt(queryOld);
- HMSExternalCatalog catalog = createAndGetCatalog(analyzedStmt,
"hms_s3_old");
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(queryOld);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalog = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog("hms_s3_old");
Map<String, String> properties =
catalog.getCatalogProperty().getProperties();
Assertions.assertEquals(13, properties.size());
@@ -208,8 +213,14 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 's3.access_key' = 'akk',\n"
+ " 's3.secret_key' = 'skk'\n"
+ ");";
- CreateCatalogStmt analyzedStmt = createStmt(query);
- HMSExternalCatalog catalog = createAndGetCatalog(analyzedStmt,
"hms_s3");
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(query);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalog = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog("hms_s3");
Map<String, String> properties =
catalog.getCatalogProperty().getProperties();
Assertions.assertEquals(13, properties.size());
@@ -230,8 +241,14 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'oss.secret_key' = 'skk'\n"
+ ");";
String catalogName = "hms_oss_hdfs";
- CreateCatalogStmt analyzedStmt = createStmt(query1);
- HMSExternalCatalog catalog = createAndGetCatalog(analyzedStmt,
catalogName);
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(query1);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalog = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName);
Map<String, String> hdProps =
catalog.getCatalogProperty().getHadoopProperties();
Assertions.assertEquals("com.aliyun.jindodata.oss.JindoOssFileSystem",
hdProps.get("fs.oss.impl"));
Assertions.assertEquals("cn-beijing.oss-dls.aliyuncs.com",
hdProps.get("fs.oss.endpoint"));
@@ -252,8 +269,14 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'dlf.access.public' = 'false'\n"
+ ");";
String catalogName = "hms_dlf1";
- CreateCatalogStmt analyzedStmt = createStmt(queryDlf1);
- HMSExternalCatalog catalog = createAndGetCatalog(analyzedStmt,
catalogName);
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(queryDlf1);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalog = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName);
Map<String, String> properties =
catalog.getCatalogProperty().getProperties();
Assertions.assertEquals("hms", properties.get("type"));
Assertions.assertEquals("dlf",
properties.get(HMSProperties.HIVE_METASTORE_TYPE));
@@ -283,8 +306,13 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'dlf.catalog.accessPublic' = 'true'\n"
+ ");";
String catalogName2 = "hms_dlf2";
- CreateCatalogStmt analyzedStmt2 = createStmt(queryDlf2);
- HMSExternalCatalog catalog2 = createAndGetCatalog(analyzedStmt2,
catalogName2);
+
+ logicalPlan = nereidsParser.parseSingle(queryDlf2);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalog2 = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName2);
Map<String, String> properties2 =
catalog2.getCatalogProperty().getProperties();
Assertions.assertEquals("dlf",
properties2.get(HMSProperties.HIVE_METASTORE_TYPE));
Assertions.assertEquals("akk",
properties2.get(DataLakeConfig.CATALOG_ACCESS_KEY_ID));
@@ -309,8 +337,13 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'dlf.region' = 'cn-beijing'\n"
+ ");";
String catalogName3 = "dlf_iceberg";
- CreateCatalogStmt analyzedStmt3 = createStmt(queryDlfIceberg);
- IcebergExternalCatalog catalog3 =
createAndGetIcebergCatalog(analyzedStmt3, catalogName3);
+
+ logicalPlan = nereidsParser.parseSingle(queryDlfIceberg);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ IcebergExternalCatalog catalog3 = (IcebergExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName3);
Map<String, String> properties3 =
catalog3.getCatalogProperty().getProperties();
Assertions.assertEquals("dlf",
properties3.get(IcebergExternalCatalog.ICEBERG_CATALOG_TYPE));
Assertions.assertEquals("akk",
properties3.get(DataLakeConfig.CATALOG_ACCESS_KEY_ID));
@@ -335,8 +368,13 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'mc.endpoint' =
'http://service.cn-beijing-vpc.maxcompute.aliyun-inc.com/api' \n"
+ ");";
String catalogName = "hms_mc";
- CreateCatalogStmt analyzedStmt = createStmt(queryDlf1);
- Env.getCurrentEnv().getCatalogMgr().createCatalog(analyzedStmt);
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(queryDlf1);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
MaxComputeExternalCatalog catalog = (MaxComputeExternalCatalog)
Env.getCurrentEnv()
.getCatalogMgr().getCatalog(catalogName);
Map<String, String> properties =
catalog.getCatalogProperty().getProperties();
@@ -361,8 +399,14 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'aws.region' = 'us-east-1'\n"
+ ");";
String catalogName = "hms_glue_old";
- CreateCatalogStmt analyzedStmt = createStmt(queryOld);
- HMSExternalCatalog catalog = createAndGetCatalog(analyzedStmt,
catalogName);
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(queryOld);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalog = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName);
Map<String, String> properties = catalog.getProperties();
Assertions.assertEquals(22, properties.size());
Assertions.assertEquals("s3.us-east-1.amazonaws.com",
properties.get(S3Properties.ENDPOINT));
@@ -380,8 +424,13 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " 'glue.secret_key' = 'skk'\n"
+ ");";
catalogName = "hms_glue";
- CreateCatalogStmt analyzedStmtNew = createStmt(query);
- HMSExternalCatalog catalogNew = createAndGetCatalog(analyzedStmtNew,
catalogName);
+
+ logicalPlan = nereidsParser.parseSingle(query);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalogNew = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName);
Map<String, String> propertiesNew = catalogNew.getProperties();
Assertions.assertEquals(22, propertiesNew.size());
Assertions.assertEquals("s3.us-east-1.amazonaws.com.cn",
propertiesNew.get(S3Properties.ENDPOINT));
@@ -443,8 +492,14 @@ public class PropertyConverterTest extends
TestWithFeService {
String endpoint, String sql,
int catalogPropsSize, int
bePropsSize) throws Exception {
Env.getCurrentEnv().getCatalogMgr().dropCatalog(new
DropCatalogStmt(true, catalogName));
- CreateCatalogStmt analyzedStmt = createStmt(sql);
- HMSExternalCatalog catalog = createAndGetCatalog(analyzedStmt,
catalogName);
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(sql);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ HMSExternalCatalog catalog = (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName);
Map<String, String> properties =
catalog.getCatalogProperty().getProperties();
Assertions.assertEquals(catalogPropsSize, properties.size());
@@ -471,18 +526,6 @@ public class PropertyConverterTest extends
TestWithFeService {
});
}
- private static HMSExternalCatalog createAndGetCatalog(CreateCatalogStmt
analyzedStmt, String name)
- throws UserException {
- Env.getCurrentEnv().getCatalogMgr().createCatalog(analyzedStmt);
- return (HMSExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(name);
- }
-
- private static IcebergExternalCatalog
createAndGetIcebergCatalog(CreateCatalogStmt analyzedStmt, String name)
- throws UserException {
- Env.getCurrentEnv().getCatalogMgr().createCatalog(analyzedStmt);
- return (IcebergExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog(name);
- }
-
@Test
public void testSerialization() throws Exception {
MetaContext metaContext = new MetaContext();
@@ -734,8 +777,14 @@ public class PropertyConverterTest extends
TestWithFeService {
+ " \"glue.access_key\" = \"ak123\",\n"
+ " \"glue.secret_key\" = \"sk123\"\n"
+ ");";
- CreateCatalogStmt analyzedStmt = createStmt(createIceGlue);
- IcebergExternalCatalog icebergExternalCatalog =
createAndGetIcebergCatalog(analyzedStmt, "iceglue");
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createIceGlue);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
+
+ IcebergExternalCatalog icebergExternalCatalog =
(IcebergExternalCatalog)
Env.getCurrentEnv().getCatalogMgr().getCatalog("iceglue");
Assertions.assertTrue(icebergExternalCatalog instanceof
IcebergGlueExternalCatalog);
IcebergGlueExternalCatalog glueCatalog = (IcebergGlueExternalCatalog)
icebergExternalCatalog;
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/external/hms/HmsCatalogTest.java
b/fe/fe-core/src/test/java/org/apache/doris/external/hms/HmsCatalogTest.java
index 09c4f472b95..e3726f3e9a2 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/external/hms/HmsCatalogTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/external/hms/HmsCatalogTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.external.hms;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.PrimitiveType;
@@ -35,6 +34,9 @@ import org.apache.doris.datasource.hive.HMSExternalTable;
import org.apache.doris.datasource.hive.HMSExternalTable.DLAType;
import org.apache.doris.datasource.hive.HiveDlaTable;
import org.apache.doris.nereids.datasets.tpch.AnalyzeCheckTestBase;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.qe.SessionVariable;
import com.google.common.collect.Lists;
@@ -74,10 +76,16 @@ public class HmsCatalogTest extends AnalyzeCheckTestBase {
mgr = env.getCatalogMgr();
// create hms catalog
- CreateCatalogStmt hmsCatalog = (CreateCatalogStmt) parseAndAnalyzeStmt(
- "create catalog hms_ctl properties('type' = 'hms',
'hive.metastore.uris' = 'thrift://192.168.0.1:9083');",
- connectContext);
- mgr.createCatalog(hmsCatalog);
+ String createStmt = "create catalog hms_ctl "
+ + "properties("
+ + "'type' = 'hms', "
+ + "'hive.metastore.uris' = 'thrift://192.168.0.1:9083');";
+
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
// create inner db and tbl for test
mgr.getInternalCatalog().createDb("test", false, Maps.newHashMap());
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/qe/HmsQueryCacheTest.java
b/fe/fe-core/src/test/java/org/apache/doris/qe/HmsQueryCacheTest.java
index 106bdb94b3e..a80d2f8386b 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/qe/HmsQueryCacheTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/qe/HmsQueryCacheTest.java
@@ -17,7 +17,6 @@
package org.apache.doris.qe;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.StatementBase;
import org.apache.doris.analysis.TupleDescriptor;
import org.apache.doris.analysis.TupleId;
@@ -38,6 +37,9 @@ import org.apache.doris.datasource.hive.HiveDlaTable;
import org.apache.doris.datasource.hive.source.HiveScanNode;
import org.apache.doris.datasource.systable.SupportedSysTables;
import org.apache.doris.nereids.datasets.tpch.AnalyzeCheckTestBase;
+import org.apache.doris.nereids.parser.NereidsParser;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
import org.apache.doris.planner.OlapScanNode;
import org.apache.doris.planner.PlanNodeId;
import org.apache.doris.planner.ScanNode;
@@ -82,10 +84,15 @@ public class HmsQueryCacheTest extends AnalyzeCheckTestBase
{
mgr = env.getCatalogMgr();
// create hms catalog
- CreateCatalogStmt hmsCatalogStmt = (CreateCatalogStmt)
parseAndAnalyzeStmt(
- "create catalog hms_ctl properties('type' = 'hms',
'hive.metastore.uris' = 'thrift://192.168.0.1:9083');",
- connectContext);
- mgr.createCatalog(hmsCatalogStmt);
+ String createStmt = "create catalog hms_ctl "
+ + "properties("
+ + "'type' = 'hms', "
+ + "'hive.metastore.uris' = 'thrift://192.168.0.1:9083');";
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(createStmt);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
// create inner db and tbl for test
mgr.getInternalCatalog().createDb("test", false, Maps.newHashMap());
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java
b/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java
index d13fce7a0a4..af9ff710a68 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/utframe/TestWithFeService.java
@@ -20,7 +20,6 @@ package org.apache.doris.utframe;
import org.apache.doris.alter.AlterJobV2;
import org.apache.doris.analysis.AlterSqlBlockRuleStmt;
import org.apache.doris.analysis.AlterTableStmt;
-import org.apache.doris.analysis.CreateCatalogStmt;
import org.apache.doris.analysis.CreateSqlBlockRuleStmt;
import org.apache.doris.analysis.CreateTableStmt;
import org.apache.doris.analysis.DropSqlBlockRuleStmt;
@@ -53,6 +52,7 @@ import
org.apache.doris.nereids.trees.expressions.StatementScopeIdGenerator;
import org.apache.doris.nereids.trees.plans.commands.AddConstraintCommand;
import org.apache.doris.nereids.trees.plans.commands.AlterMTMVCommand;
import org.apache.doris.nereids.trees.plans.commands.AlterTableCommand;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateDatabaseCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateFunctionCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateMTMVCommand;
@@ -675,8 +675,11 @@ public abstract class TestWithFeService {
}
public void createCatalog(String sql) throws Exception {
- CreateCatalogStmt stmt = (CreateCatalogStmt) parseAndAnalyzeStmt(sql,
connectContext);
- Env.getCurrentEnv().getCatalogMgr().createCatalog(stmt);
+ NereidsParser nereidsParser = new NereidsParser();
+ LogicalPlan logicalPlan = nereidsParser.parseSingle(sql);
+ if (logicalPlan instanceof CreateCatalogCommand) {
+ ((CreateCatalogCommand) logicalPlan).run(connectContext, null);
+ }
}
public CatalogIf getCatalog(String name) throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]