Skip to content

Commit bf340ad

Browse files
authored
[Chore](nereids) Remove AlterDatabaseStmt (apache#52109)
1 parent aa9b1dc commit bf340ad

File tree

10 files changed

+18
-500
lines changed

10 files changed

+18
-500
lines changed

fe/fe-core/src/main/cup/sql_parser.cup

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,26 +1290,6 @@ alter_stmt ::=
12901290
{:
12911291
RESULT = new AlterTableStmt(tbl, clauses);
12921292
:}
1293-
| KW_ALTER KW_DATABASE ident:dbName KW_SET KW_DATA KW_QUOTA quantity:quota_quantity
1294-
{:
1295-
RESULT = new AlterDatabaseQuotaStmt(dbName, QuotaType.DATA, quota_quantity);
1296-
:}
1297-
| KW_ALTER KW_DATABASE ident:dbName KW_SET KW_REPLICA KW_QUOTA INTEGER_LITERAL:number
1298-
{:
1299-
RESULT = new AlterDatabaseQuotaStmt(dbName, QuotaType.REPLICA, String.valueOf(number));
1300-
:}
1301-
| KW_ALTER KW_DATABASE ident:dbName KW_SET KW_TRANSACTION KW_QUOTA INTEGER_LITERAL:number
1302-
{:
1303-
RESULT = new AlterDatabaseQuotaStmt(dbName, QuotaType.TRANSACTION, String.valueOf(number));
1304-
:}
1305-
| KW_ALTER KW_DATABASE ident:dbName KW_RENAME ident:newDbName
1306-
{:
1307-
RESULT = new AlterDatabaseRename(dbName, newDbName);
1308-
:}
1309-
| KW_ALTER KW_DATABASE ident:dbName KW_SET KW_PROPERTIES LPAREN key_value_map:map RPAREN
1310-
{:
1311-
RESULT = new AlterDatabasePropertyStmt(dbName, map);
1312-
:}
13131293
| KW_ALTER KW_COLOCATE KW_GROUP colocate_group_name:colocateGroupName KW_SET LPAREN key_value_map:properties RPAREN
13141294
{:
13151295
RESULT = new AlterColocateGroupStmt(colocateGroupName, properties);

fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabasePropertyStmt.java

Lines changed: 0 additions & 84 deletions
This file was deleted.

fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseQuotaStmt.java

Lines changed: 0 additions & 96 deletions
This file was deleted.

fe/fe-core/src/main/java/org/apache/doris/analysis/AlterDatabaseRename.java

Lines changed: 0 additions & 81 deletions
This file was deleted.

fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
import org.apache.doris.analysis.AddPartitionClause;
2828
import org.apache.doris.analysis.AddPartitionLikeClause;
2929
import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
30-
import org.apache.doris.analysis.AlterDatabasePropertyStmt;
31-
import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
32-
import org.apache.doris.analysis.AlterDatabaseRename;
3330
import org.apache.doris.analysis.AlterMultiPartitionClause;
3431
import org.apache.doris.analysis.AlterTableStmt;
3532
import org.apache.doris.analysis.AlterViewStmt;
@@ -3444,18 +3441,10 @@ public void replayRecoverDatabase(RecoverInfo info) {
34443441
getInternalCatalog().replayRecoverDatabase(info);
34453442
}
34463443

3447-
public void alterDatabaseQuota(AlterDatabaseQuotaStmt stmt) throws DdlException {
3448-
getInternalCatalog().alterDatabaseQuota(stmt.getDbName(), stmt.getQuotaType(), stmt.getQuota());
3449-
}
3450-
34513444
public void replayAlterDatabaseQuota(String dbName, long quota, QuotaType quotaType) throws MetaNotFoundException {
34523445
getInternalCatalog().replayAlterDatabaseQuota(dbName, quota, quotaType);
34533446
}
34543447

3455-
public void alterDatabaseProperty(AlterDatabasePropertyStmt stmt) throws DdlException {
3456-
getInternalCatalog().alterDatabaseProperty(stmt);
3457-
}
3458-
34593448
public void alterDatabaseProperty(String dbName, Map<String, String> properties) throws DdlException {
34603449
getInternalCatalog().alterDatabaseProperty(dbName, properties);
34613450
}
@@ -3465,10 +3454,6 @@ public void replayAlterDatabaseProperty(String dbName, Map<String, String> prope
34653454
getInternalCatalog().replayAlterDatabaseProperty(dbName, properties);
34663455
}
34673456

3468-
public void renameDatabase(AlterDatabaseRename stmt) throws DdlException {
3469-
getInternalCatalog().renameDatabase(stmt.getDbName(), stmt.getNewDbName());
3470-
}
3471-
34723457
public void replayRenameDatabase(String dbName, String newDbName) {
34733458
getInternalCatalog().replayRenameDatabase(dbName, newDbName);
34743459
}

fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.doris.analysis.AddPartitionLikeClause;
2323
import org.apache.doris.analysis.AddRollupClause;
2424
import org.apache.doris.analysis.AlterClause;
25-
import org.apache.doris.analysis.AlterDatabasePropertyStmt;
2625
import org.apache.doris.analysis.AlterMultiPartitionClause;
2726
import org.apache.doris.analysis.CreateTableStmt;
2827
import org.apache.doris.analysis.DataSortInfo;
@@ -794,13 +793,6 @@ public void alterDatabaseProperty(String dbName, Map<String, String> properties)
794793
}
795794
}
796795

797-
public void alterDatabaseProperty(AlterDatabasePropertyStmt stmt) throws DdlException {
798-
String dbName = stmt.getDbName();
799-
Map<String, String> properties = stmt.getProperties();
800-
801-
alterDatabaseProperty(dbName, properties);
802-
}
803-
804796
public void replayAlterDatabaseProperty(String dbName, Map<String, String> properties)
805797
throws MetaNotFoundException {
806798
Database db = (Database) getDbOrMetaException(dbName);

fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterDatabasePropertiesCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ public void doRun(ConnectContext ctx, StmtExecutor executor) throws Exception {
7575
Env.getCurrentEnv().alterDatabaseProperty(dbName, properties);
7676
}
7777

78+
public String getDbName() {
79+
return dbName;
80+
}
81+
82+
public Map<String, String> getProperties() {
83+
return properties;
84+
}
85+
7886
@Override
7987
public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
8088
return visitor.visitAlterDatabasePropertiesCommand(this, context);

fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
2121
import org.apache.doris.analysis.AlterColocateGroupStmt;
22-
import org.apache.doris.analysis.AlterDatabasePropertyStmt;
23-
import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
24-
import org.apache.doris.analysis.AlterDatabaseRename;
2522
import org.apache.doris.analysis.AlterJobStatusStmt;
2623
import org.apache.doris.analysis.AlterRepositoryStmt;
2724
import org.apache.doris.analysis.AlterRoleStmt;
@@ -178,10 +175,7 @@ public static void execute(Env env, DdlStmt ddlStmt) throws Exception {
178175
env.getAuth().dropRole((DropRoleStmt) ddlStmt);
179176
} else if (ddlStmt instanceof SetUserPropertyStmt) {
180177
env.getAuth().updateUserProperty((SetUserPropertyStmt) ddlStmt);
181-
} else if (ddlStmt instanceof AlterDatabaseQuotaStmt) {
182-
env.alterDatabaseQuota((AlterDatabaseQuotaStmt) ddlStmt);
183-
} else if (ddlStmt instanceof AlterDatabaseRename) {
184-
env.renameDatabase((AlterDatabaseRename) ddlStmt);
178+
185179
} else if (ddlStmt instanceof RecoverDbStmt) {
186180
env.recoverDatabase((RecoverDbStmt) ddlStmt);
187181
} else if (ddlStmt instanceof RecoverTableStmt) {
@@ -218,8 +212,6 @@ public static void execute(Env env, DdlStmt ddlStmt) throws Exception {
218212
env.getSqlBlockRuleMgr().alterSqlBlockRule((AlterSqlBlockRuleStmt) ddlStmt);
219213
} else if (ddlStmt instanceof DropSqlBlockRuleStmt) {
220214
env.getSqlBlockRuleMgr().dropSqlBlockRule((DropSqlBlockRuleStmt) ddlStmt);
221-
} else if (ddlStmt instanceof AlterDatabasePropertyStmt) {
222-
env.alterDatabaseProperty((AlterDatabasePropertyStmt) ddlStmt);
223215
} else if (ddlStmt instanceof RefreshTableStmt) {
224216
RefreshTableStmt refreshTableStmt = (RefreshTableStmt) ddlStmt;
225217
env.getRefreshManager().handleRefreshTable(refreshTableStmt.getCtl(), refreshTableStmt.getDbName(),

0 commit comments

Comments
 (0)