wangbo commented on code in PR #18990:
URL: https://github.com/apache/doris/pull/18990#discussion_r1178541166


##########
fe/fe-core/src/main/java/org/apache/doris/resource/resourcegroup/ResourceGroupMgr.java:
##########
@@ -151,10 +155,30 @@ public void createResourceGroup(CreateResourceGroupStmt 
stmt) throws DdlExceptio
         LOG.info("Create resource group success: {}", resourceGroup);
     }
 
-    public void dropResourceGroup(DropResourceGroupStmt stmt) throws 
DdlException {
-        if (!Config.enable_resource_group) {
-            throw new DdlException("unsupported feature now, coming soon.");
+    public void alterResourceGroup(AlterResourceGroupStmt stmt) throws 
DdlException {
+        checkResourceGroupEnabled();
+
+        String resourceGroupName = stmt.getResourceGroupName();
+        Map<String, String> properties = stmt.getProperties();
+        ResourceGroup newResourceGroup;
+        writeLock();
+        try {
+            if (!nameToResourceGroup.containsKey(resourceGroupName)) {
+                throw new DdlException("Resource Group(" + resourceGroupName + 
") does not exist.");
+            }
+            ResourceGroup resourceGroup = 
nameToResourceGroup.get(resourceGroupName);
+            newResourceGroup = ResourceGroup.create(resourceGroup, properties);
+            nameToResourceGroup.put(resourceGroupName, newResourceGroup);

Review Comment:
   It seems that currently we not support partial attribute alter group.
   Need a todo here/



##########
fe/fe-core/src/main/java/org/apache/doris/resource/resourcegroup/ResourceGroupMgr.java:
##########
@@ -151,10 +155,30 @@ public void createResourceGroup(CreateResourceGroupStmt 
stmt) throws DdlExceptio
         LOG.info("Create resource group success: {}", resourceGroup);
     }
 
-    public void dropResourceGroup(DropResourceGroupStmt stmt) throws 
DdlException {
-        if (!Config.enable_resource_group) {
-            throw new DdlException("unsupported feature now, coming soon.");
+    public void alterResourceGroup(AlterResourceGroupStmt stmt) throws 
DdlException {
+        checkResourceGroupEnabled();
+
+        String resourceGroupName = stmt.getResourceGroupName();
+        Map<String, String> properties = stmt.getProperties();
+        ResourceGroup newResourceGroup;
+        writeLock();
+        try {
+            if (!nameToResourceGroup.containsKey(resourceGroupName)) {
+                throw new DdlException("Resource Group(" + resourceGroupName + 
") does not exist.");
+            }
+            ResourceGroup resourceGroup = 
nameToResourceGroup.get(resourceGroupName);
+            newResourceGroup = ResourceGroup.create(resourceGroup, properties);
+            nameToResourceGroup.put(resourceGroupName, newResourceGroup);

Review Comment:
   It seems that currently we not support partial attribute alter group.
   Need a todo here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to