luozenglin commented on code in PR #18184:
URL: https://github.com/apache/doris/pull/18184#discussion_r1152156843


##########
fe/fe-common/src/main/java/org/apache/doris/common/FeMetaVersion.java:
##########
@@ -56,9 +56,11 @@ public final class FeMetaVersion {
     public static final int VERSION_117 = 117;
     // change frontend meta to json, add hostname to MasterInfo
     public static final int VERSION_118 = 118;
+    // add resource group
+    public static final int VERSION_119 = 119;
 
     // note: when increment meta version, should assign the latest version to 
VERSION_CURRENT
-    public static final int VERSION_CURRENT = VERSION_118;
+    public static final int VERSION_CURRENT = VERSION_119;

Review Comment:
   removed it



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/PipelineResourceGroup.java:
##########
@@ -0,0 +1,128 @@
+// 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.catalog;
+
+import org.apache.doris.common.FeConstants;
+import org.apache.doris.common.io.DeepCopy;
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.io.Writable;
+import org.apache.doris.common.proc.BaseProcResult;
+import org.apache.doris.persist.gson.GsonPostProcessable;
+import org.apache.doris.persist.gson.GsonUtils;
+import org.apache.doris.thrift.TPipelineResourceGroup;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.gson.annotations.SerializedName;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+public class PipelineResourceGroup implements Writable, GsonPostProcessable {
+
+    private static final Logger LOG = 
LogManager.getLogger(PipelineResourceGroup.class);
+
+    @SerializedName(value = "id")
+    private long id;
+
+    @SerializedName(value = "name")
+    private String name;
+
+    @SerializedName(value = "properties")
+    private Map<String, String> properties;
+
+    // version update required after alter resource group
+    @SerializedName(value = "version")
+    private long version;
+
+    @SerializedName(value = "parentName")
+    private String parentName;
+
+    @SerializedName(value = "childrenNames")
+    private Set<String> childrenNames;
+
+    public PipelineResourceGroup(long id, String name, Map<String, String> 
properties, String parentName) {
+        this.id = id;
+        this.name = name;
+        this.properties = properties;
+        this.parentName = parentName;
+        this.childrenNames = Sets.newHashSet();
+        this.version = 0;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public Map<String, String> getProperties() {
+        return properties;
+    }
+
+    public String getParentName() {
+        return parentName;
+    }
+
+    public void getProcNodeData(BaseProcResult result) {
+        for (Map.Entry<String, String> entry : properties.entrySet()) {
+            result.addRow(Lists.newArrayList(String.valueOf(id), name, 
entry.getKey(), entry.getValue()));
+        }
+    }
+
+    @Override
+    public String toString() {
+        return GsonUtils.GSON.toJson(this);
+    }
+
+    @Override
+    public PipelineResourceGroup clone() {
+        PipelineResourceGroup copied = DeepCopy.copy(this, 
PipelineResourceGroup.class, FeConstants.meta_version);
+        if (copied == null) {
+            LOG.warn("failed to clone resource group: " + getName());
+            return null;
+        }
+        return copied;
+    }
+
+    public TPipelineResourceGroup toThrift() {
+        return new TPipelineResourceGroup(id, name, properties, version);
+    }
+
+    @Override
+    public void write(DataOutput out) throws IOException {
+        String json = GsonUtils.GSON.toJson(this);
+        Text.writeString(out, json);
+    }
+
+    public static PipelineResourceGroup read(DataInput in) throws IOException {
+        String json = Text.readString(in);
+        return GsonUtils.GSON.fromJson(json, PipelineResourceGroup.class);
+    }
+
+    @Override
+    public void gsonPostProcess() throws IOException {

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to