forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Support DDL [Drop external catalog catalog_name;] for exter…
…nal catalog (StarRocks#5839)
- Loading branch information
Showing
8 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
fe/fe-core/src/main/java/com/starrocks/analysis/DropCatalogStmt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// This file is licensed under the Elastic License 2.0. Copyright 2021-present, StarRocks Limited. | ||
|
||
package com.starrocks.analysis; | ||
|
||
import com.google.common.base.Strings; | ||
import com.starrocks.catalog.InternalCatalog; | ||
import com.starrocks.sql.analyzer.SemanticException; | ||
import com.starrocks.sql.ast.AstVisitor; | ||
|
||
// ToDo(zhuodong): to support internal catalog in the future | ||
public class DropCatalogStmt extends DdlStmt { | ||
|
||
private final String name; | ||
|
||
public DropCatalogStmt(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void analyze() throws SemanticException { | ||
// TODO check permission | ||
if (Strings.isNullOrEmpty(name)) { | ||
throw new SemanticException("'catalog name' can not be null or empty"); | ||
} | ||
|
||
if (name.equals(InternalCatalog.DEFAULT_INTERNAL_CATALOG_NAME)) { | ||
throw new SemanticException("Can't drop the default internal catalog"); | ||
} | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) { | ||
return visitor.visitDropCatalogStatement(this, context); | ||
} | ||
|
||
@Override | ||
public String toSql() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("DROP EXTERNAL CATALOG "); | ||
sb.append("\'" + name + "\'"); | ||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters