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 2e7d57a10f4 [Chore](nereids) Remove AlterColocateGroupStmt (#54383)
2e7d57a10f4 is described below

commit 2e7d57a10f4a0fcc3b4d58df6524af674d1cdb83
Author: yaoxiao <[email protected]>
AuthorDate: Wed Aug 6 17:19:24 2025 +0800

    [Chore](nereids) Remove AlterColocateGroupStmt (#54383)
---
 fe/fe-core/src/main/cup/sql_parser.cup             |  4 -
 .../doris/analysis/AlterColocateGroupStmt.java     | 87 ----------------------
 .../apache/doris/catalog/ColocateTableIndex.java   | 62 ---------------
 .../main/java/org/apache/doris/qe/DdlExecutor.java |  3 -
 4 files changed, 156 deletions(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 704fc13695b..1602b1fe880 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -1269,10 +1269,6 @@ alter_stmt ::=
     {:
         RESULT = new AlterTableStmt(tbl, clauses);
     :}
-    | KW_ALTER KW_COLOCATE KW_GROUP colocate_group_name:colocateGroupName 
KW_SET LPAREN key_value_map:properties RPAREN
-    {:
-        RESULT = new AlterColocateGroupStmt(colocateGroupName, properties);
-    :}
     | KW_ALTER KW_WORKLOAD KW_GROUP ident_or_text:workloadGroupName 
opt_properties:properties
     {:
         RESULT = new AlterWorkloadGroupStmt(workloadGroupName, properties);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterColocateGroupStmt.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterColocateGroupStmt.java
deleted file mode 100644
index 7a7fa03ead4..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AlterColocateGroupStmt.java
+++ /dev/null
@@ -1,87 +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.datasource.InternalCatalog;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.base.Strings;
-
-import java.util.Map;
-
-public class AlterColocateGroupStmt extends DdlStmt implements 
NotFallbackInParser {
-    private final ColocateGroupName colocateGroupName;
-    private final Map<String, String> properties;
-
-    public AlterColocateGroupStmt(ColocateGroupName colocateGroupName, 
Map<String, String> properties) {
-        this.colocateGroupName = colocateGroupName;
-        this.properties = properties;
-    }
-
-    public ColocateGroupName getColocateGroupName() {
-        return colocateGroupName;
-    }
-
-    public Map<String, String> getProperties() {
-        return properties;
-    }
-
-    @Override
-    public void analyze() throws UserException {
-        super.analyze();
-        colocateGroupName.analyze();
-
-        String dbName = colocateGroupName.getDb();
-        if (Strings.isNullOrEmpty(dbName)) {
-            if (!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(
-                        ConnectContext.get(), PrivPredicate.ADMIN)) {
-                
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, 
"ADMIN");
-            }
-        } else {
-            if (!Env.getCurrentEnv().getAccessManager().checkDbPriv(
-                    ConnectContext.get(), 
InternalCatalog.INTERNAL_CATALOG_NAME, dbName, PrivPredicate.ADMIN)) {
-                
ErrorReport.reportAnalysisException(ErrorCode.ERR_DBACCESS_DENIED_ERROR,
-                        ConnectContext.get().getQualifiedUser(), dbName);
-            }
-        }
-
-        if (properties == null || properties.isEmpty()) {
-            throw new AnalysisException("Colocate group properties can't be 
null");
-        }
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("ALTER COLOCATE GROUP 
").append(colocateGroupName.toSql()).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/catalog/ColocateTableIndex.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java
index 8b5ddd243c6..f670892fec1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java
@@ -17,7 +17,6 @@
 
 package org.apache.doris.catalog;
 
-import org.apache.doris.analysis.AlterColocateGroupStmt;
 import org.apache.doris.clone.ColocateTableCheckerAndBalancer;
 import org.apache.doris.common.Config;
 import org.apache.doris.common.DdlException;
@@ -877,67 +876,6 @@ public class ColocateTableIndex implements Writable {
         }
     }
 
-    public void alterColocateGroup(AlterColocateGroupStmt stmt) throws 
UserException {
-        writeLock();
-        try {
-            Map<String, String> properties = stmt.getProperties();
-            String dbName = stmt.getColocateGroupName().getDb();
-            String groupName = stmt.getColocateGroupName().getGroup();
-            long dbId = 0;
-            if (!GroupId.isGlobalGroupName(groupName)) {
-                Database db = (Database) 
Env.getCurrentInternalCatalog().getDbOrMetaException(dbName);
-                dbId = db.getId();
-            }
-            String fullGroupName = GroupId.getFullGroupName(dbId, groupName);
-            ColocateGroupSchema groupSchema = getGroupSchema(fullGroupName);
-            if (groupSchema == null) {
-                throw new DdlException("Not found colocate group " + 
stmt.getColocateGroupName().toSql());
-            }
-
-            GroupId groupId = groupSchema.getGroupId();
-
-            if (properties.size() > 1) {
-                throw new DdlException("Can only set one colocate group 
property at a time");
-            }
-
-            if 
(properties.containsKey(PropertyAnalyzer.PROPERTIES_REPLICATION_NUM)
-                    || 
properties.containsKey(PropertyAnalyzer.PROPERTIES_REPLICATION_ALLOCATION)) {
-                if (Config.isCloudMode()) {
-                    throw new DdlException("Cann't modify colocate group 
replication in cloud mode");
-                }
-
-                ReplicaAllocation replicaAlloc = 
PropertyAnalyzer.analyzeReplicaAllocation(properties, "");
-                Preconditions.checkState(!replicaAlloc.isNotSet());
-                
Env.getCurrentSystemInfo().checkReplicaAllocation(replicaAlloc);
-                Map<Tag, List<List<Long>>> backendsPerBucketSeq = 
getBackendsPerBucketSeq(groupId);
-                Map<Tag, List<List<Long>>> newBackendsPerBucketSeq = 
Maps.newHashMap();
-                for (Map.Entry<Tag, List<List<Long>>> entry : 
backendsPerBucketSeq.entrySet()) {
-                    List<List<Long>> newList = Lists.newArrayList();
-                    for (List<Long> backends : entry.getValue()) {
-                        newList.add(Lists.newArrayList(backends));
-                    }
-                    newBackendsPerBucketSeq.put(entry.getKey(), newList);
-                }
-                try {
-                    
ColocateTableCheckerAndBalancer.modifyGroupReplicaAllocation(replicaAlloc,
-                            newBackendsPerBucketSeq, 
groupSchema.getBucketsNum());
-                } catch (Exception e) {
-                    LOG.warn("modify group [{}, {}] to replication allocation 
{} failed, bucket seq {}",
-                            fullGroupName, groupId, replicaAlloc, 
backendsPerBucketSeq, e);
-                    throw new DdlException(e.getMessage());
-                }
-                backendsPerBucketSeq = newBackendsPerBucketSeq;
-                Preconditions.checkState(backendsPerBucketSeq.size() == 
replicaAlloc.getAllocMap().size());
-                modifyColocateGroupReplicaAllocation(groupSchema.getGroupId(), 
replicaAlloc,
-                        backendsPerBucketSeq, true);
-            } else {
-                throw new DdlException("Unknown colocate group property: " + 
properties.keySet());
-            }
-        } finally {
-            writeUnlock();
-        }
-    }
-
     private void modifyColocateGroupReplicaAllocation(GroupId groupId, 
ReplicaAllocation replicaAlloc,
             Map<Tag, List<List<Long>>> backendsPerBucketSeq, boolean isReplay) 
throws UserException {
         ColocateGroupSchema groupSchema = getGroupSchema(groupId);
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 3e840d96da5..e7daee7bc39 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
@@ -18,7 +18,6 @@
 package org.apache.doris.qe;
 
 import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
-import org.apache.doris.analysis.AlterColocateGroupStmt;
 import org.apache.doris.analysis.AlterJobStatusStmt;
 import org.apache.doris.analysis.AlterRepositoryStmt;
 import org.apache.doris.analysis.AlterRoleStmt;
@@ -170,8 +169,6 @@ public class DdlExecutor {
         } else if (ddlStmt instanceof RefreshDbStmt) {
             RefreshDbStmt refreshDbStmt = (RefreshDbStmt) ddlStmt;
             
env.getRefreshManager().handleRefreshDb(refreshDbStmt.getCatalogName(), 
refreshDbStmt.getDbName());
-        } else if (ddlStmt instanceof AlterColocateGroupStmt) {
-            
env.getColocateTableIndex().alterColocateGroup((AlterColocateGroupStmt) 
ddlStmt);
         } else if (ddlStmt instanceof AlterWorkloadGroupStmt) {
             
env.getWorkloadGroupMgr().alterWorkloadGroup((AlterWorkloadGroupStmt) ddlStmt);
         } else if (ddlStmt instanceof CreateIndexPolicyStmt) {


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

Reply via email to