Alima777 commented on a change in pull request #1771:
URL: https://github.com/apache/incubator-iotdb/pull/1771#discussion_r496346212



##########
File path: 
server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateMultiTimeSeriesPlan.java
##########
@@ -0,0 +1,284 @@
+/*
+ * 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 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;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * create multiple timeSeries, could be split to several sub Plans to execute 
in different DataGroup
+ */
+public class CreateMultiTimeSeriesPlan extends PhysicalPlan {
+  private List<PartialPath> paths;
+  private List<TSDataType> dataTypes;
+  private List<TSEncoding> encodings;
+  private List<CompressionType> compressors;
+  private List<String> alias;
+  private List<Map<String, String>> props = null;
+  private List<Map<String, String>> tags = null;
+  private List<Map<String, String>> attributes = null;
+
+  /*
+   ** record the result of creation of time series
+   */
+  private Map<Integer, Boolean> results = new HashMap<>();
+  private List<Integer> indexes;
+
+  public CreateMultiTimeSeriesPlan() {
+    super(false, Operator.OperatorType.CREATE_MULTI_TIMESERIES);
+  }
+
+  @Override
+  public List<PartialPath> getPaths() {
+    return paths;
+  }
+
+  public void setPaths(List<PartialPath> paths) {
+    this.paths = paths;
+  }
+
+  public List<TSDataType> getDataTypes() {
+    return dataTypes;
+  }
+
+  public void setDataTypes(List<TSDataType> dataTypes) {
+    this.dataTypes = dataTypes;
+  }
+
+  public List<TSEncoding> getEncodings() {
+    return encodings;
+  }
+
+  public void setEncodings(List<TSEncoding> encodings) {
+    this.encodings = encodings;
+  }
+
+  public List<CompressionType> getCompressors() {
+    return compressors;
+  }
+
+  public void setCompressors(List<CompressionType> compressors) {
+    this.compressors = compressors;
+  }
+
+  public List<String> getAlias() {
+    return alias;
+  }
+
+  public void setAlias(List<String> alias) {
+    this.alias = alias;
+  }
+
+  public List<Map<String, String>> getProps() {
+    return props;
+  }
+
+  public void setProps(List<Map<String, String>> props) {
+    this.props = props;
+  }
+
+  public List<Map<String, String>> getTags() {
+    return tags;
+  }
+
+  public void setTags(List<Map<String, String>> tags) {
+    this.tags = tags;
+  }
+
+  public List<Map<String, String>> getAttributes() {
+    return attributes;
+  }
+
+  public void setAttributes(List<Map<String, String>> attributes) {
+    this.attributes = attributes;
+  }
+
+  public List<Integer> getIndexes() {
+    return indexes;
+  }
+
+  public void setIndexes(List<Integer> indexes) {
+    this.indexes = indexes;
+  }
+
+  public Map<Integer, Boolean> getResults() {
+    return results;
+  }
+
+  public void setResults(Map<Integer, Boolean> results) {
+    this.results = results;
+  }
+
+  @Override
+  public void serialize(DataOutputStream stream) throws IOException {
+    int type = PhysicalPlanType.MULTI_CREATE_TIMESERIES.ordinal();
+    stream.write(type);
+    stream.writeInt(paths.size());
+
+    for (PartialPath path : paths) {
+      putString(stream, path.getFullPath());
+    }
+
+    for (TSDataType dataType : dataTypes) {
+      stream.write(dataType.ordinal());
+    }
+
+    for (TSEncoding encoding : encodings) {
+      stream.write(encoding.ordinal());
+    }
+
+    for (CompressionType compressor : compressors) {
+      stream.write(compressor.ordinal());
+    }
+
+    for (String name : alias) {
+      putString(stream, name);
+    }
+
+    if (props != null) {
+      stream.write(1);
+      for (Map<String, String> prop : props) {
+        ReadWriteIOUtils.write(prop, stream);
+      }
+    } else {
+      stream.write(0);
+    }
+
+    if (tags != null) {
+      stream.write(1);
+      for (Map<String, String> tag : tags) {
+        ReadWriteIOUtils.write(tag, stream);
+      }
+    } else {
+      stream.write(0);
+    }
+
+    if (attributes != null) {
+      stream.write(1);
+      for (Map<String, String> attribute : attributes) {
+        ReadWriteIOUtils.write(attribute, stream);
+      }
+    } else {
+      stream.write(0);
+    }
+  }
+
+  @Override
+  public void serialize(ByteBuffer buffer) {
+    int type = PhysicalPlanType.MULTI_CREATE_TIMESERIES.ordinal();
+    buffer.put((byte) type);
+    buffer.putInt(paths.size());
+
+    for (PartialPath path : paths) {
+      putString(buffer, path.getFullPath());
+    }
+
+    for (TSDataType dataType : dataTypes) {
+      buffer.put((byte) dataType.ordinal());
+    }
+
+    for (TSEncoding encoding : encodings) {
+      buffer.put((byte) encoding.ordinal());
+    }
+
+    for (CompressionType compressor : compressors) {
+      buffer.put((byte) compressor.ordinal());
+    }
+
+    for (String name : alias) {
+      putString(buffer, name);
+    }
+
+    if (props != null) {
+      buffer.put((byte) 1);
+      for (Map<String, String> prop : props) {
+        ReadWriteIOUtils.write(prop, buffer);
+      }
+    } else {
+      buffer.put((byte) 0);
+    }
+
+    if (tags != null) {
+      buffer.put((byte) 1);
+      for (Map<String, String> tag : tags) {
+        ReadWriteIOUtils.write(tag, buffer);
+      }
+    } else {
+      buffer.put((byte) 0);
+    }
+
+    if (attributes != null) {
+      buffer.put((byte) 1);
+      for (Map<String, String> attribute : attributes) {
+        ReadWriteIOUtils.write(attribute, buffer);
+      }
+    } else {
+      buffer.put((byte) 0);
+    }
+  }
+
+  @Override
+  public void deserialize(ByteBuffer buffer) throws IllegalPathException {
+    int totalSize = buffer.getInt();
+    for (int i = 0; i < totalSize; i++) {
+      paths.add(new PartialPath(readString(buffer)));
+    }
+    for (int i = 0; i < totalSize; i++) {
+      dataTypes.add(TSDataType.values()[buffer.get()]);
+    }
+    for (int i = 0; i < totalSize; i++) {
+      encodings.add(TSEncoding.values()[buffer.get()]);
+    }
+
+    for (int i = 0; i < totalSize; i++) {
+      alias.add(readString(buffer));
+    }

Review comment:
       Same.

##########
File path: 
server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateMultiTimeSeriesPlan.java
##########
@@ -0,0 +1,284 @@
+/*
+ * 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 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;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * create multiple timeSeries, could be split to several sub Plans to execute 
in different DataGroup
+ */
+public class CreateMultiTimeSeriesPlan extends PhysicalPlan {
+  private List<PartialPath> paths;
+  private List<TSDataType> dataTypes;
+  private List<TSEncoding> encodings;
+  private List<CompressionType> compressors;
+  private List<String> alias;
+  private List<Map<String, String>> props = null;
+  private List<Map<String, String>> tags = null;
+  private List<Map<String, String>> attributes = null;
+
+  /*
+   ** record the result of creation of time series
+   */
+  private Map<Integer, Boolean> results = new HashMap<>();
+  private List<Integer> indexes;
+
+  public CreateMultiTimeSeriesPlan() {
+    super(false, Operator.OperatorType.CREATE_MULTI_TIMESERIES);
+  }
+
+  @Override
+  public List<PartialPath> getPaths() {
+    return paths;
+  }
+
+  public void setPaths(List<PartialPath> paths) {
+    this.paths = paths;
+  }
+
+  public List<TSDataType> getDataTypes() {
+    return dataTypes;
+  }
+
+  public void setDataTypes(List<TSDataType> dataTypes) {
+    this.dataTypes = dataTypes;
+  }
+
+  public List<TSEncoding> getEncodings() {
+    return encodings;
+  }
+
+  public void setEncodings(List<TSEncoding> encodings) {
+    this.encodings = encodings;
+  }
+
+  public List<CompressionType> getCompressors() {
+    return compressors;
+  }
+
+  public void setCompressors(List<CompressionType> compressors) {
+    this.compressors = compressors;
+  }
+
+  public List<String> getAlias() {
+    return alias;
+  }
+
+  public void setAlias(List<String> alias) {
+    this.alias = alias;
+  }
+
+  public List<Map<String, String>> getProps() {
+    return props;
+  }
+
+  public void setProps(List<Map<String, String>> props) {
+    this.props = props;
+  }
+
+  public List<Map<String, String>> getTags() {
+    return tags;
+  }
+
+  public void setTags(List<Map<String, String>> tags) {
+    this.tags = tags;
+  }
+
+  public List<Map<String, String>> getAttributes() {
+    return attributes;
+  }
+
+  public void setAttributes(List<Map<String, String>> attributes) {
+    this.attributes = attributes;
+  }
+
+  public List<Integer> getIndexes() {
+    return indexes;
+  }
+
+  public void setIndexes(List<Integer> indexes) {
+    this.indexes = indexes;
+  }
+
+  public Map<Integer, Boolean> getResults() {
+    return results;
+  }
+
+  public void setResults(Map<Integer, Boolean> results) {
+    this.results = results;
+  }
+
+  @Override
+  public void serialize(DataOutputStream stream) throws IOException {
+    int type = PhysicalPlanType.MULTI_CREATE_TIMESERIES.ordinal();
+    stream.write(type);
+    stream.writeInt(paths.size());
+
+    for (PartialPath path : paths) {
+      putString(stream, path.getFullPath());
+    }
+
+    for (TSDataType dataType : dataTypes) {
+      stream.write(dataType.ordinal());
+    }
+
+    for (TSEncoding encoding : encodings) {
+      stream.write(encoding.ordinal());
+    }
+
+    for (CompressionType compressor : compressors) {
+      stream.write(compressor.ordinal());
+    }
+
+    for (String name : alias) {

Review comment:
       alias maybe null, please change the logic here.

##########
File path: 
server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateMultiTimeSeriesPlan.java
##########
@@ -0,0 +1,284 @@
+/*
+ * 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 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;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * create multiple timeSeries, could be split to several sub Plans to execute 
in different DataGroup
+ */
+public class CreateMultiTimeSeriesPlan extends PhysicalPlan {
+  private List<PartialPath> paths;
+  private List<TSDataType> dataTypes;
+  private List<TSEncoding> encodings;
+  private List<CompressionType> compressors;
+  private List<String> alias;
+  private List<Map<String, String>> props = null;
+  private List<Map<String, String>> tags = null;
+  private List<Map<String, String>> attributes = null;
+
+  /*
+   ** record the result of creation of time series
+   */
+  private Map<Integer, Boolean> results = new HashMap<>();
+  private List<Integer> indexes;
+
+  public CreateMultiTimeSeriesPlan() {
+    super(false, Operator.OperatorType.CREATE_MULTI_TIMESERIES);
+  }
+
+  @Override
+  public List<PartialPath> getPaths() {
+    return paths;
+  }
+
+  public void setPaths(List<PartialPath> paths) {
+    this.paths = paths;
+  }
+
+  public List<TSDataType> getDataTypes() {
+    return dataTypes;
+  }
+
+  public void setDataTypes(List<TSDataType> dataTypes) {
+    this.dataTypes = dataTypes;
+  }
+
+  public List<TSEncoding> getEncodings() {
+    return encodings;
+  }
+
+  public void setEncodings(List<TSEncoding> encodings) {
+    this.encodings = encodings;
+  }
+
+  public List<CompressionType> getCompressors() {
+    return compressors;
+  }
+
+  public void setCompressors(List<CompressionType> compressors) {
+    this.compressors = compressors;
+  }
+
+  public List<String> getAlias() {
+    return alias;
+  }
+
+  public void setAlias(List<String> alias) {
+    this.alias = alias;
+  }
+
+  public List<Map<String, String>> getProps() {
+    return props;
+  }
+
+  public void setProps(List<Map<String, String>> props) {
+    this.props = props;
+  }
+
+  public List<Map<String, String>> getTags() {
+    return tags;
+  }
+
+  public void setTags(List<Map<String, String>> tags) {
+    this.tags = tags;
+  }
+
+  public List<Map<String, String>> getAttributes() {
+    return attributes;
+  }
+
+  public void setAttributes(List<Map<String, String>> attributes) {
+    this.attributes = attributes;
+  }
+
+  public List<Integer> getIndexes() {
+    return indexes;
+  }
+
+  public void setIndexes(List<Integer> indexes) {
+    this.indexes = indexes;
+  }
+
+  public Map<Integer, Boolean> getResults() {
+    return results;
+  }
+
+  public void setResults(Map<Integer, Boolean> results) {
+    this.results = results;
+  }
+
+  @Override
+  public void serialize(DataOutputStream stream) throws IOException {
+    int type = PhysicalPlanType.MULTI_CREATE_TIMESERIES.ordinal();
+    stream.write(type);
+    stream.writeInt(paths.size());
+
+    for (PartialPath path : paths) {
+      putString(stream, path.getFullPath());
+    }
+
+    for (TSDataType dataType : dataTypes) {
+      stream.write(dataType.ordinal());
+    }
+
+    for (TSEncoding encoding : encodings) {
+      stream.write(encoding.ordinal());
+    }
+
+    for (CompressionType compressor : compressors) {
+      stream.write(compressor.ordinal());
+    }
+
+    for (String name : alias) {
+      putString(stream, name);
+    }
+
+    if (props != null) {
+      stream.write(1);
+      for (Map<String, String> prop : props) {
+        ReadWriteIOUtils.write(prop, stream);
+      }
+    } else {
+      stream.write(0);
+    }
+
+    if (tags != null) {
+      stream.write(1);
+      for (Map<String, String> tag : tags) {
+        ReadWriteIOUtils.write(tag, stream);
+      }
+    } else {
+      stream.write(0);
+    }
+
+    if (attributes != null) {
+      stream.write(1);
+      for (Map<String, String> attribute : attributes) {
+        ReadWriteIOUtils.write(attribute, stream);
+      }
+    } else {
+      stream.write(0);
+    }
+  }
+
+  @Override
+  public void serialize(ByteBuffer buffer) {
+    int type = PhysicalPlanType.MULTI_CREATE_TIMESERIES.ordinal();
+    buffer.put((byte) type);
+    buffer.putInt(paths.size());
+
+    for (PartialPath path : paths) {
+      putString(buffer, path.getFullPath());
+    }
+
+    for (TSDataType dataType : dataTypes) {
+      buffer.put((byte) dataType.ordinal());
+    }
+
+    for (TSEncoding encoding : encodings) {
+      buffer.put((byte) encoding.ordinal());
+    }
+
+    for (CompressionType compressor : compressors) {
+      buffer.put((byte) compressor.ordinal());
+    }
+
+    for (String name : alias) {
+      putString(buffer, name);
+    }

Review comment:
       Same.




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


Reply via email to