You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/02/20 02:26:22 UTC

[GitHub] [iotdb] JackieTien97 commented on a change in pull request #2468: [ISSUE-2484] Fix creating timeseries error by using "create" or "insert" statement

JackieTien97 commented on a change in pull request #2468:
URL: https://github.com/apache/iotdb/pull/2468#discussion_r579575176



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java
##########
@@ -233,4 +235,20 @@ void serializeChildren(MLogWriter logWriter) throws IOException {
       entry.getValue().serializeTo(logWriter);
     }
   }
+
+  public void replaceChild(String measurement, MNode newChildNode) {
+    MNode oldChildNode = this.getChild(measurement);
+    if (oldChildNode == null) {
+      return;
+    }
+    Map<String, MNode> grandChildren = oldChildNode.getChildren();
+    // newChildNode builds parent-child relationship
+    newChildNode.setChildren(grandChildren);
+    grandChildren.forEach(
+        (grandChildName, grandChildNode) -> grandChildNode.setParent(newChildNode));

Review comment:
       Don't forget to replace the aliasChildren Map




----------------------------------------------------------------
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.

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