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 b40194dab05 [Chore](nereids)  Remove AlterResource/PolicyStmt (#52105)
b40194dab05 is described below

commit b40194dab0542c648f9a84e6a01d756cbc3e1685
Author: yaoxiao <[email protected]>
AuthorDate: Thu Jun 26 18:24:48 2025 +0800

    [Chore](nereids)  Remove AlterResource/PolicyStmt (#52105)
---
 fe/fe-core/src/main/cup/sql_parser.cup             |   8 --
 .../org/apache/doris/analysis/AlterPolicyStmt.java | 104 ---------------------
 .../apache/doris/analysis/AlterResourceStmt.java   |  95 -------------------
 .../java/org/apache/doris/catalog/ResourceMgr.java |   8 --
 .../java/org/apache/doris/policy/PolicyMgr.java    |   8 --
 .../main/java/org/apache/doris/qe/DdlExecutor.java |  10 +-
 6 files changed, 1 insertion(+), 232 deletions(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index b02b88ad7f6..fc5a32fe604 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -1374,10 +1374,6 @@ alter_stmt ::=
     {:
         RESULT = new AlterDatabasePropertyStmt(dbName, map);
     :}
-    | KW_ALTER KW_RESOURCE ident_or_text:resourceName opt_properties:properties
-    {:
-        RESULT = new AlterResourceStmt(resourceName, properties);
-    :}
     | KW_ALTER KW_COLOCATE KW_GROUP colocate_group_name:colocateGroupName 
KW_SET LPAREN key_value_map:properties RPAREN
     {:
         RESULT = new AlterColocateGroupStmt(colocateGroupName, properties);
@@ -1410,10 +1406,6 @@ alter_stmt ::=
         ModifyTablePropertiesClause clause = new 
ModifyTablePropertiesClause(properties);
         RESULT = new AlterTableStmt(tbl, Lists.newArrayList(clause));
     :}
-    | KW_ALTER KW_STORAGE KW_POLICY ident_or_text:policyName 
opt_properties:properties
-    {:
-        RESULT = new AlterPolicyStmt(policyName, properties);
-    :}
     | KW_ALTER KW_REPOSITORY ident:repoName opt_properties:properties
     {:
         RESULT = new AlterRepositoryStmt(repoName, properties);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterPolicyStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterPolicyStmt.java
deleted file mode 100644
index 1dd54f6f1b1..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterPolicyStmt.java
+++ /dev/null
@@ -1,104 +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.PrintableMap;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.policy.Policy;
-import org.apache.doris.policy.PolicyTypeEnum;
-import org.apache.doris.policy.StoragePolicy;
-import org.apache.doris.qe.ConnectContext;
-
-import lombok.Data;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-/**
- * Alter policy
- **/
-@Data
-public class AlterPolicyStmt extends DdlStmt implements NotFallbackInParser {
-    private final String policyName;
-    private final Map<String, String> properties;
-
-    public AlterPolicyStmt(String policyName, Map<String, String> properties) {
-        this.policyName = policyName;
-        this.properties = properties;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-
-        // check auth
-        // check if can alter policy and use storage_resource
-        if (!Env.getCurrentEnv().getAccessManager()
-                .checkGlobalPriv(ConnectContext.get(), PrivPredicate.ADMIN)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-                    PrivPredicate.ADMIN.getPrivs().toString());
-        }
-
-        if (properties == null || properties.isEmpty()) {
-            throw new AnalysisException("policy properties can't be null");
-        }
-
-        if (Env.getCurrentEnv().getPolicyMgr().findPolicy(this.policyName, 
PolicyTypeEnum.ROW).isPresent()) {
-            throw new AnalysisException("Current not support alter row 
policy");
-        }
-
-        // check resource existence
-        List<Policy> policiesByType = Env.getCurrentEnv().getPolicyMgr()
-                .getCopiedPoliciesByType(PolicyTypeEnum.STORAGE);
-        Optional<Policy> hasPolicy = policiesByType.stream()
-                .filter(policy -> 
policy.getPolicyName().equals(this.policyName)).findAny();
-        StoragePolicy storagePolicy = (StoragePolicy) hasPolicy.orElseThrow(
-                () -> new AnalysisException("Unknown storage policy: " + 
this.policyName)
-        );
-
-        // default storage policy use alter storage policy to add s3 resource.
-        if 
(!policyName.equalsIgnoreCase(StoragePolicy.DEFAULT_STORAGE_POLICY_NAME) && 
properties.containsKey(
-                StoragePolicy.STORAGE_RESOURCE)) {
-            throw new AnalysisException("not support change storage policy's 
storage resource"
-                    + ", you can change s3 properties by alter resource");
-        }
-
-        // check properties
-        storagePolicy.checkProperties(properties);
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("ALTER POLICY '").append(policyName).append("' ");
-        sb.append("PROPERTIES(").append(new PrintableMap<>(properties, " = ", 
true, false)).append(")");
-        return sb.toString();
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.ALTER;
-    }
-
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterResourceStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterResourceStmt.java
deleted file mode 100644
index 3b6f325e9b8..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterResourceStmt.java
+++ /dev/null
@@ -1,95 +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.catalog.Resource;
-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.PrintableMap;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import java.util.Map;
-
-public class AlterResourceStmt extends DdlStmt implements NotFallbackInParser {
-    private static final String TYPE = "type";
-
-    private final String resourceName;
-    private final Map<String, String> properties;
-
-    public AlterResourceStmt(String resourceName, Map<String, String> 
properties) {
-        this.resourceName = resourceName;
-        this.properties = properties;
-    }
-
-    public String getResourceName() {
-        return resourceName;
-    }
-
-    public Map<String, String> getProperties() {
-        return properties;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-
-        // check auth
-        if 
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.ADMIN)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, 
"ADMIN");
-        }
-
-        if (properties == null || properties.isEmpty()) {
-            throw new AnalysisException("Resource properties can't be null");
-        }
-
-        // check type in properties
-        if (properties.containsKey(TYPE)) {
-            throw new AnalysisException("Can not change resource type.");
-        }
-
-        // check resource existence
-        Resource resource = 
Env.getCurrentEnv().getResourceMgr().getResource(resourceName);
-        if (resource == null) {
-            throw new AnalysisException("Unknown resource: " + resourceName);
-        }
-        // check properties
-        resource.checkProperties(properties);
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("ALTER RESOURCE '").append(resourceName).append("' ");
-        sb.append("PROPERTIES(").append(new PrintableMap<>(properties, " = ", 
true, false, true)).append(")");
-        return sb.toString();
-    }
-
-    @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/catalog/ResourceMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/ResourceMgr.java
index 0a080dab9bc..0e3e44a4bf6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ResourceMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ResourceMgr.java
@@ -17,7 +17,6 @@
 
 package org.apache.doris.catalog;
 
-import org.apache.doris.analysis.AlterResourceStmt;
 import org.apache.doris.analysis.CreateResourceStmt;
 import org.apache.doris.catalog.Resource.ResourceType;
 import org.apache.doris.common.AnalysisException;
@@ -165,13 +164,6 @@ public class ResourceMgr implements Writable {
         LOG.info("Alter resource success. Resource: {}", resource);
     }
 
-    public void alterResource(AlterResourceStmt stmt) throws DdlException {
-        String resourceName = stmt.getResourceName();
-        Map<String, String> properties = stmt.getProperties();
-
-        alterResource(resourceName, properties);
-    }
-
     public void replayAlterResource(Resource resource) {
         nameToResource.put(resource.getName(), resource);
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/policy/PolicyMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/policy/PolicyMgr.java
index 9476e30dd9c..3aacf3d7f4c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/policy/PolicyMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/policy/PolicyMgr.java
@@ -17,7 +17,6 @@
 
 package org.apache.doris.policy;
 
-import org.apache.doris.analysis.AlterPolicyStmt;
 import org.apache.doris.analysis.UserIdentity;
 import org.apache.doris.catalog.Database;
 import org.apache.doris.catalog.Env;
@@ -688,13 +687,6 @@ public class PolicyMgr implements Writable {
         LOG.info("Alter storage policy success. policy: {}", storagePolicy);
     }
 
-    /*
-     * Alter policy by stmt.
-     **/
-    public void alterPolicy(AlterPolicyStmt stmt) throws DdlException, 
AnalysisException {
-        alterPolicy(stmt.getPolicyName(), stmt.getProperties());
-    }
-
     /**
      * Check storage policy whether exist by policy name.
      **/
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 c69945b634c..8a9aa118af2 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
@@ -24,9 +24,7 @@ import org.apache.doris.analysis.AlterDatabasePropertyStmt;
 import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
 import org.apache.doris.analysis.AlterDatabaseRename;
 import org.apache.doris.analysis.AlterJobStatusStmt;
-import org.apache.doris.analysis.AlterPolicyStmt;
 import org.apache.doris.analysis.AlterRepositoryStmt;
-import org.apache.doris.analysis.AlterResourceStmt;
 import org.apache.doris.analysis.AlterRoleStmt;
 import org.apache.doris.analysis.AlterRoutineLoadStmt;
 import org.apache.doris.analysis.AlterSqlBlockRuleStmt;
@@ -253,14 +251,10 @@ public class DdlExecutor {
             env.getRefreshManager().handleRefreshTable((RefreshTableStmt) 
ddlStmt);
         } else if (ddlStmt instanceof RefreshDbStmt) {
             env.getRefreshManager().handleRefreshDb((RefreshDbStmt) ddlStmt);
-        } else if (ddlStmt instanceof AlterResourceStmt) {
-            env.getResourceMgr().alterResource((AlterResourceStmt) ddlStmt);
         } else if (ddlStmt instanceof AlterColocateGroupStmt) {
             
env.getColocateTableIndex().alterColocateGroup((AlterColocateGroupStmt) 
ddlStmt);
         } else if (ddlStmt instanceof AlterWorkloadGroupStmt) {
             
env.getWorkloadGroupMgr().alterWorkloadGroup((AlterWorkloadGroupStmt) ddlStmt);
-        } else if (ddlStmt instanceof AlterPolicyStmt) {
-            env.getPolicyMgr().alterPolicy((AlterPolicyStmt) ddlStmt);
         } else if (ddlStmt instanceof CreateIndexPolicyStmt) {
             env.getIndexPolicyMgr().createIndexPolicy((CreateIndexPolicyStmt) 
ddlStmt);
         } else if (ddlStmt instanceof DropIndexPolicyStmt) {
@@ -398,9 +392,7 @@ public class DdlExecutor {
         if (ddlStmt instanceof BackupStmt
                 || ddlStmt instanceof RestoreStmt
                 || ddlStmt instanceof CreateRepositoryStmt
-                || ddlStmt instanceof DropRepositoryStmt
-                || ddlStmt instanceof AlterResourceStmt
-                || ddlStmt instanceof AlterPolicyStmt) {
+                || ddlStmt instanceof DropRepositoryStmt) {
             LOG.info("stmt={}, not supported in cloud mode", 
ddlStmt.toString());
             throw new DdlException("Unsupported operation");
         }


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

Reply via email to