You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2019/08/26 07:57:58 UTC

[incubator-iotdb] 01/01: rename FileSchema to Schema

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch fix_schema_name
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 064523e2156b76f333e04e1e07a00623b65497bc
Author: qiaojialin <64...@qq.com>
AuthorDate: Mon Aug 26 15:57:41 2019 +0800

    rename FileSchema to Schema
---
 docs/Documentation/UserGuide/8-TsFile/2-Usage.md         | 16 ++++++++--------
 .../org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java  |  6 +++---
 .../db/engine/storagegroup/StorageGroupProcessor.java    |  4 ++--
 .../db/utils/{FileSchemaUtils.java => SchemaUtils.java}  | 12 ++++++------
 .../db/engine/storagegroup/TsFileProcessorTest.java      | 10 +++++-----
 .../org/apache/iotdb/tsfile/write/ReadPageInMemTest.java |  4 ++--
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/docs/Documentation/UserGuide/8-TsFile/2-Usage.md b/docs/Documentation/UserGuide/8-TsFile/2-Usage.md
index 63447db..ae8bb14 100644
--- a/docs/Documentation/UserGuide/8-TsFile/2-Usage.md
+++ b/docs/Documentation/UserGuide/8-TsFile/2-Usage.md
@@ -85,12 +85,12 @@ A TsFile can be generated by following three steps and the complete code will be
     ```
     * With pre-defined schema
 	```
-	public TsFileWriter(File file, FileSchema schema) throws IOException
+	public TsFileWriter(File file, Schema schema) throws IOException
 	```
 	This one is for using the HDFS file system. `TsFileOutput` can be an instance of class `HDFSOutput`.
 	
 	```
-	public TsFileWriter(TsFileOutput output, FileSchema schema) throws IOException 
+	public TsFileWriter(TsFileOutput output, Schema schema) throws IOException 
     ```
 	**Parameters:**
 	
@@ -100,15 +100,15 @@ A TsFile can be generated by following three steps and the complete code will be
 
 * Second, add measurements
 	
-	Or you can make an instance of class `FileSchema` first and pass this to the constructor of class `TsFileWriter`
+	Or you can make an instance of class `Schema` first and pass this to the constructor of class `TsFileWriter`
 	
-	The class `FileSchema` contains a map whose key is the name of one measurement schema, and the value is the schema itself.
+	The class `Schema` contains a map whose key is the name of one measurement schema, and the value is the schema itself.
 	
 	Here are the interfaces:
 	```
-	// Create an empty FileSchema or from an existing map
-	public FileSchema()
-	public FileSchema(Map<String, MeasurementSchema> measurements)
+	// Create an empty Schema or from an existing map
+	public Schema()
+	public Schema(Map<String, MeasurementSchema> measurements)
     
 	// Use this two interfaces to add measurements
 	public void registerMeasurement(MeasurementSchema descriptor)
@@ -275,7 +275,7 @@ public class TsFileWriteWithRowBatch {
         f.delete();
       }
 
-      FileSchema schema = new FileSchema();
+      Schema schema = new Schema();
 
       // the number of rows to include in the row batch
       int rowNum = 1000000;
diff --git a/hadoop/src/main/java/org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java b/hadoop/src/main/java/org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java
index 3f23cf6..bfc2f89 100644
--- a/hadoop/src/main/java/org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java
+++ b/hadoop/src/main/java/org/apache/iotdb/tsfile/hadoop/TSFRecordWriter.java
@@ -30,7 +30,7 @@ import org.apache.iotdb.tsfile.hadoop.io.HDFSOutputStream;
 import org.apache.iotdb.tsfile.timeseries.basis.TsFile;
 import org.apache.iotdb.tsfile.write.exception.InvalidJsonSchemaException;
 import org.apache.iotdb.tsfile.write.exception.WriteProcessException;
-import org.apache.iotdb.tsfile.write.schema.FileSchema;
+import org.apache.iotdb.tsfile.write.schema.Schema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,9 +42,9 @@ public class TSFRecordWriter extends RecordWriter<NullWritable, TSRow> {
 
   public TSFRecordWriter(Path path, JSONObject schema) throws InterruptedException, IOException {
     // construct the internalrecordwriter
-    FileSchema fileSchema = null;
+    Schema fileSchema = null;
     try {
-      fileSchema = new FileSchema(schema);
+      fileSchema = new Schema(schema);
     } catch (InvalidJsonSchemaException e) {
       throw new InterruptedException(String.format("Construct the tsfile schema failed"), e);
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index 11d9fff..c6324eb 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -164,7 +164,7 @@ public class StorageGroupProcessor {
     this.storageGroupName = storageGroupName;
 
     // construct the file schema
-    this.schema = constructFileSchema(storageGroupName);
+    this.schema = constructSchema(storageGroupName);
 
     try {
       File storageGroupSysDir = new File(systemInfoDir, storageGroupName);
@@ -249,7 +249,7 @@ public class StorageGroupProcessor {
     }
   }
 
-  private Schema constructFileSchema(String storageGroupName) {
+  private Schema constructSchema(String storageGroupName) {
     List<MeasurementSchema> columnSchemaList;
     columnSchemaList = MManager.getInstance().getSchemaForStorageGroup(storageGroupName);
 
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/FileSchemaUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
similarity index 83%
rename from server/src/main/java/org/apache/iotdb/db/utils/FileSchemaUtils.java
rename to server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
index 8011489..cae69e3 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/FileSchemaUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
@@ -25,9 +25,9 @@ import org.apache.iotdb.tsfile.write.schema.Schema;
 import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
 
 
-public class FileSchemaUtils {
+public class SchemaUtils {
 
-  private FileSchemaUtils(){}
+  private SchemaUtils(){}
 
   /**
    * Construct the Schema of the FileNode named processorName.
@@ -35,19 +35,19 @@ public class FileSchemaUtils {
    * @return the schema of the FileNode named processorName.
    * @throws WriteProcessException when the fileSchema cannot be created.
    */
-  public static Schema constructFileSchema(String processorName) {
+  public static Schema constructSchema(String processorName) {
     List<MeasurementSchema> columnSchemaList;
     columnSchemaList = MManager.getInstance().getSchemaForStorageGroup(processorName);
-    return getFileSchemaFromColumnSchema(columnSchemaList);
+    return getSchemaFromColumnSchema(columnSchemaList);
   }
 
   /**
-   * getFileSchemaFromColumnSchema construct a Schema using the schema of the columns and the
+   * getSchemaFromColumnSchema construct a Schema using the schema of the columns and the
    * device type.
    * @param schemaList the schema of the columns in this file.
    * @return a Schema contains the provided schemas.
    */
-  public static Schema getFileSchemaFromColumnSchema(List<MeasurementSchema> schemaList) {
+  public static Schema getSchemaFromColumnSchema(List<MeasurementSchema> schemaList) {
     Schema schema = new Schema();
     for (MeasurementSchema measurementSchema : schemaList) {
       schema.registerMeasurement(measurementSchema);
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
index 9508f4c..a61534a 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
@@ -36,7 +36,7 @@ import org.apache.iotdb.db.exception.TsFileProcessorException;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.db.utils.FileSchemaUtils;
+import org.apache.iotdb.db.utils.SchemaUtils;
 import org.apache.iotdb.db.utils.TimeValuePair;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
 import org.apache.iotdb.tsfile.file.metadata.ChunkGroupMetaData;
@@ -77,7 +77,7 @@ public class TsFileProcessorTest {
   public void testWriteAndFlush()
       throws WriteProcessException, IOException, TsFileProcessorException {
     processor = new TsFileProcessor(storageGroup, new File(filePath),
-        FileSchemaUtils.constructFileSchema(deviceId), SysTimeVersionController.INSTANCE, x -> {
+        SchemaUtils.constructSchema(deviceId), SysTimeVersionController.INSTANCE, x -> {
     },
         () -> true, true);
 
@@ -124,7 +124,7 @@ public class TsFileProcessorTest {
   public void testWriteAndRestoreMetadata()
       throws IOException {
     processor = new TsFileProcessor(storageGroup, new File(filePath),
-        FileSchemaUtils.constructFileSchema(deviceId), SysTimeVersionController.INSTANCE, x -> {
+        SchemaUtils.constructSchema(deviceId), SysTimeVersionController.INSTANCE, x -> {
     },
         () -> true, true);
 
@@ -191,7 +191,7 @@ public class TsFileProcessorTest {
   public void testMultiFlush()
       throws WriteProcessException, IOException, TsFileProcessorException {
     processor = new TsFileProcessor(storageGroup, new File(filePath),
-        FileSchemaUtils.constructFileSchema(deviceId), SysTimeVersionController.INSTANCE, x -> {
+        SchemaUtils.constructSchema(deviceId), SysTimeVersionController.INSTANCE, x -> {
     },
         () -> true, true);
 
@@ -227,7 +227,7 @@ public class TsFileProcessorTest {
   public void testWriteAndClose()
       throws WriteProcessException, IOException {
     processor = new TsFileProcessor(storageGroup, new File(filePath),
-        FileSchemaUtils.constructFileSchema(deviceId), SysTimeVersionController.INSTANCE,
+        SchemaUtils.constructSchema(deviceId), SysTimeVersionController.INSTANCE,
         unsealedTsFileProcessor -> {
           TsFileResource resource = unsealedTsFileProcessor.getTsFileResource();
           synchronized (resource) {
diff --git a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/ReadPageInMemTest.java b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/ReadPageInMemTest.java
index 796b719..1d4f9b6 100644
--- a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/ReadPageInMemTest.java
+++ b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/ReadPageInMemTest.java
@@ -49,7 +49,7 @@ public class ReadPageInMemTest {
   private int pageCheckSizeThreshold;
   private int defaultMaxStringLength;
 
-  private static Schema getFileSchema() {
+  private static Schema getSchema() {
     Schema schema = new Schema();
     TSFileConfig conf = TSFileDescriptor.getInstance().getConfig();
     schema.registerMeasurement(new MeasurementSchema("s1", TSDataType.INT32, TSEncoding.valueOf(conf.valueEncoder)));
@@ -70,7 +70,7 @@ public class ReadPageInMemTest {
     conf.pageCheckSizeThreshold = 1;
     defaultMaxStringLength = conf.maxStringLength;
     conf.maxStringLength = 2;
-    schema = getFileSchema();
+    schema = getSchema();
     innerWriter = new TsFileWriter(new File(filePath), schema, conf);
   }