HTHou commented on a change in pull request #3407:
URL: https://github.com/apache/iotdb/pull/3407#discussion_r653169147



##########
File path: session/src/main/java/org/apache/iotdb/session/Session.java
##########
@@ -1790,6 +1790,81 @@ public void createSchemaTemplate(
     defaultSessionConnection.createSchemaTemplate(request);
   }
 
+  public void createSchemaTemplate(String templateName, 
List<IMeasurementSchema> measurementSchemas)
+      throws IoTDBConnectionException, StatementExecutionException {
+    List<String> schemaNames = new ArrayList<>();
+    List<List<String>> measurements = new ArrayList<>();
+    List<List<TSDataType>> dataTypes = new ArrayList<>();
+    List<List<TSEncoding>> encodings = new ArrayList<>();
+
+    List<CompressionType> compressors = new ArrayList<>();
+    for (IMeasurementSchema measurementSchema : measurementSchemas) {
+      schemaNames.add(measurementSchema.getMeasurementId());
+      
measurements.add(Collections.singletonList(measurementSchema.getMeasurementId()));
+      dataTypes.add(Collections.singletonList(measurementSchema.getType()));
+      
encodings.add(Collections.singletonList(measurementSchema.getEncodingType()));
+
+      compressors.add(measurementSchema.getCompressor());
+    }
+
+    TSCreateSchemaTemplateReq request =
+        getTSCreateSchemaTemplateReq(
+            templateName, schemaNames, measurements, dataTypes, encodings, 
compressors);
+    defaultSessionConnection.createSchemaTemplate(request);
+  }
+
+  public void createMeasurementSchemaTemplate(
+      String name,
+      String path,
+      TSDataType dataType,
+      TSEncoding encoding,
+      CompressionType compressor)
+      throws IoTDBConnectionException, StatementExecutionException {
+    List<String> schemaNames = new ArrayList<>();
+    List<List<String>> measurements = new ArrayList<>();
+    List<List<TSDataType>> dataTypes = new ArrayList<>();
+    List<List<TSEncoding>> encodings = new ArrayList<>();
+    List<CompressionType> compressors = new ArrayList<>();
+
+    schemaNames.add(path);
+    measurements.add(Collections.singletonList(path));
+    dataTypes.add(Collections.singletonList(dataType));
+    encodings.add(Collections.singletonList(encoding));
+    compressors.add(compressor);
+
+    TSCreateSchemaTemplateReq request =
+        getTSCreateSchemaTemplateReq(
+            name, schemaNames, measurements, dataTypes, encodings, 
compressors);
+    defaultSessionConnection.createSchemaTemplate(request);
+  }
+
+  public void createVectorSchemaTemplate(

Review comment:
       These two methods are not necessary.




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