samperson1997 commented on a change in pull request #2468:
URL: https://github.com/apache/iotdb/pull/2468#discussion_r565083860
##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java
##########
@@ -250,4 +252,20 @@ void serializeChildren(MLogWriter logWriter) throws
IOException {
entry.getValue().serializeTo(logWriter);
}
}
+
+ public void replaceChild(String measurement, MNode newChildNode) {
+ MNode child = this.getChild(measurement);
+ if (child == null) {
+ return;
+ }
+ Map<String, MNode> children = child.getChildren();
Review comment:
`children` is a protected transient volatile value in this class. Please
rename it in this method
##########
File path:
server/src/main/java/org/apache/iotdb/db/qp/physical/sys/AlterTimeSeriesBasicInfoPlan.java
##########
@@ -0,0 +1,116 @@
+/*
+ * 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.iotdb.db.qp.physical.sys;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.PartialPath;
+import org.apache.iotdb.db.qp.logical.Operator;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
+
+public class AlterTimeSeriesBasicInfoPlan extends PhysicalPlan {
+
+ public void setPath(PartialPath path) {
+ this.path = path;
+ }
+
+ public TSDataType getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(TSDataType dataType) {
+ this.dataType = dataType;
+ }
+
+ public TSEncoding getEncodingType() {
+ return encodingType;
+ }
+
+ public void setEncodingType(TSEncoding encodingType) {
+ this.encodingType = encodingType;
+ }
+
+ public CompressionType getCompressor() {
+ return compressor;
+ }
+
+ public void setCompressor(CompressionType compressor) {
+ this.compressor = compressor;
+ }
+
+ private PartialPath path;
+ private TSDataType dataType;
+ private TSEncoding encodingType;
+ private CompressionType compressor;
+
+ public AlterTimeSeriesBasicInfoPlan() {
+ super(false, Operator.OperatorType.ALTER_TIMESERIES_BASIC_INFO);
+ }
+
+ public AlterTimeSeriesBasicInfoPlan(PartialPath path,
+ TSDataType dataType, TSEncoding encodingType, CompressionType
compressor) {
+ super(false, Operator.OperatorType.ALTER_TIMESERIES_BASIC_INFO);
+ this.path = path;
+ this.dataType = dataType;
+ this.encodingType = encodingType;
+ this.compressor = compressor;
+ }
+
+ @Override
+ public List<PartialPath> getPaths() {
+ return null;
Review comment:
```suggestion
return Collections.emptyList();
```
##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
##########
@@ -971,8 +994,32 @@ private boolean match(PartialPath fullPath, String[]
prefixNodes) {
}
- protected MeasurementMNode getMeasurementMNode(MNode deviceMNode, String
measurement) {
Review comment:
I prefer to keep the old function because the cluster module `CMManager`
is extending this function...
##########
File path:
cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
##########
@@ -1283,7 +1283,6 @@ public void convertToFullPaths(PhysicalPlan plan)
}
}
- @Override
Review comment:
... so that the `@Override` could not be removed
##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java
##########
@@ -250,4 +252,20 @@ void serializeChildren(MLogWriter logWriter) throws
IOException {
entry.getValue().serializeTo(logWriter);
}
}
+
+ public void replaceChild(String measurement, MNode newChildNode) {
+ MNode child = this.getChild(measurement);
+ if (child == null) {
+ return;
+ }
+ Map<String, MNode> children = child.getChildren();
+ //newChildNode builds parent-child relationship
+ newChildNode.setChildren(children);
+ children.forEach((name, childNode) -> childNode.setParent(newChildNode));
Review comment:
`name` is also a protected value of the class, so we should rename it as
well.
##########
File path:
server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
##########
@@ -31,6 +31,7 @@
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
import org.apache.iotdb.db.qp.physical.crud.InsertMultiTabletPlan;
+import org.apache.iotdb.db.qp.physical.sys.AlterTimeSeriesBasicInfoPlan;
Review comment:
Remove unused import
##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
##########
@@ -1760,28 +1807,27 @@ public MNode
getSeriesSchemasAndReadLockDevice(InsertPlan plan)
MNode deviceMNode = getDeviceNodeWithAutoCreate(deviceId);
// 2. get schema of each measurement
+ // if do not has measurement
+ MeasurementMNode measurementMNode;
+ TSDataType dataType;
for (int i = 0; i < measurementList.length; i++) {
try {
- // if do not has measurement
- MeasurementMNode measurementMNode;
+ dataType = getTypeInLoc(plan, i);
if (!deviceMNode.hasChild(measurementList[i])) {
// could not create it
if (!config.isAutoCreateSchemaEnabled()) {
// but measurement not in MTree and cannot auto-create, try the
cache
- measurementMNode = getMeasurementMNode(deviceMNode,
measurementList[i]);
+ measurementMNode = getMeasurementMNode(deviceMNode,
measurementList[i], dataType,
TSFileDescriptor.getInstance().getConfig().getCompressor());
if (measurementMNode == null) {
throw new PathNotExistException(deviceId + PATH_SEPARATOR +
measurementList[i]);
}
} else {
- // create it
-
- TSDataType dataType = getTypeInLoc(plan, i);
// create it, may concurrent created by multiple thread
- internalCreateTimeseries(deviceId.concatNode(measurementList[i]),
dataType);
+ internalCreateTimeseries(deviceId.concatNode(measurementList[i]),
dataType); // TODO: 2021/1/7
在这里自动创建时间序列,有默认编码(注意,只有measurement的node有编码的属性,在这创建:org/apache/iotdb/db/metadata/MTree.java:225)
Review comment:
Chinese comments are not accepted in the codes : )
----------------------------------------------------------------
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:
[email protected]