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

jackietien pushed a commit to branch AlignedReaderSelfCheck
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/AlignedReaderSelfCheck by this 
push:
     new ced4713  [IOTDB-2404] fix print-tsfile-sketch.sh read tsfile 
containing aligned timeseries (#4872)
ced4713 is described below

commit ced4713087c7a9a11341a25db9d812825129f1da
Author: Chen YZ <[email protected]>
AuthorDate: Tue Jan 18 15:42:36 2022 +0800

    [IOTDB-2404] fix print-tsfile-sketch.sh read tsfile containing aligned 
timeseries (#4872)
---
 .../apache/iotdb/tsfile/TsFileSequenceRead.java    |  8 +--
 .../apache/iotdb/db/tools/TsFileSketchTool.java    | 16 +++--
 .../compaction/utils/CompactionCheckerUtils.java   | 17 +++---
 .../iotdb/db/tools/TsFileSketchToolTest.java       | 69 ++++++++++++++++++----
 .../org/apache/iotdb/tsfile/file/MetaMarker.java   | 16 +++--
 .../iotdb/tsfile/write/TsFileIOWriterTest.java     | 12 +---
 .../write/writer/AlignedChunkWriterImplTest.java   | 17 +++---
 .../tsfile/write/writer/TimeChunkWriterTest.java   |  5 +-
 .../tsfile/write/writer/ValueChunkWriterTest.java  |  4 +-
 9 files changed, 106 insertions(+), 58 deletions(-)

diff --git 
a/example/tsfile/src/main/java/org/apache/iotdb/tsfile/TsFileSequenceRead.java 
b/example/tsfile/src/main/java/org/apache/iotdb/tsfile/TsFileSequenceRead.java
index 431b412..932984f 100644
--- 
a/example/tsfile/src/main/java/org/apache/iotdb/tsfile/TsFileSequenceRead.java
+++ 
b/example/tsfile/src/main/java/org/apache/iotdb/tsfile/TsFileSequenceRead.java
@@ -76,11 +76,11 @@ public class TsFileSequenceRead {
       while ((marker = reader.readMarker()) != MetaMarker.SEPARATOR) {
         switch (marker) {
           case MetaMarker.CHUNK_HEADER:
-          case (byte) (MetaMarker.CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK):
-          case (byte) (MetaMarker.CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK):
+          case MetaMarker.TIME_CHUNK_HEADER:
+          case MetaMarker.VALUE_CHUNK_HEADER:
           case MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER:
-          case (byte) (MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK):
-          case (byte) (MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK):
+          case MetaMarker.ONLY_ONE_PAGE_TIME_CHUNK_HEADER:
+          case MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER:
             System.out.println("\t[Chunk]");
             System.out.println("\tchunk type: " + marker);
             System.out.println("\tposition: " + reader.position());
diff --git 
a/server/src/main/java/org/apache/iotdb/db/tools/TsFileSketchTool.java 
b/server/src/main/java/org/apache/iotdb/db/tools/TsFileSketchTool.java
index 45db458..861c6e7 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/TsFileSketchTool.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/TsFileSketchTool.java
@@ -48,6 +48,8 @@ public class TsFileSketchTool {
   private PrintWriter pw;
   private TsFileSketchToolReader reader;
   private String splitStr; // for split different part of TsFile
+  TsFileMetadata tsFileMetaData;
+  List<ChunkGroupMetadata> allChunkGroupMetadata;
 
   public static void main(String[] args) throws IOException {
     Pair<String, String> fileNames = checkArgs(args);
@@ -74,6 +76,10 @@ public class TsFileSketchTool {
         str1.append("|");
       }
       splitStr = str1.toString();
+      // get metadata information
+      tsFileMetaData = reader.readFileMetadata();
+      allChunkGroupMetadata = new ArrayList<>();
+      reader.selfCheck(null, allChunkGroupMetadata, false);
     } catch (IOException e) {
       e.printStackTrace();
     }
@@ -87,11 +93,6 @@ public class TsFileSketchTool {
     printlnBoth(pw, "file path: " + filename);
     printlnBoth(pw, "file length: " + length);
 
-    // get metadata information
-    TsFileMetadata tsFileMetaData = reader.readFileMetadata();
-    List<ChunkGroupMetadata> allChunkGroupMetadata = new ArrayList<>();
-    reader.selfCheck(null, allChunkGroupMetadata, false);
-
     // print file information
     printFileInfo();
 
@@ -503,4 +504,9 @@ public class TsFileSketchTool {
       return timeseriesMetadataMap;
     }
   }
+
+  // for test
+  protected List<ChunkGroupMetadata> getAllChunkGroupMetadata() {
+    return allChunkGroupMetadata;
+  }
 }
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java
index ca236f2..fd87343 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java
@@ -31,7 +31,6 @@ import 
org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.encoding.decoder.Decoder;
 import org.apache.iotdb.tsfile.file.MetaMarker;
 import org.apache.iotdb.tsfile.file.header.ChunkGroupHeader;
@@ -194,11 +193,11 @@ public class CompactionCheckerUtils {
         while ((marker = reader.readMarker()) != MetaMarker.SEPARATOR) {
           switch (marker) {
             case MetaMarker.CHUNK_HEADER:
-            case (byte) (MetaMarker.CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK):
-            case (byte) (MetaMarker.CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK):
+            case MetaMarker.TIME_CHUNK_HEADER:
+            case MetaMarker.VALUE_CHUNK_HEADER:
             case MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER:
-            case (byte) (MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK):
-            case (byte) (MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK):
+            case MetaMarker.ONLY_ONE_PAGE_TIME_CHUNK_HEADER:
+            case MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER:
               ChunkHeader header = reader.readChunkHeader(marker);
               // read the next measurement and pack data of last measurement
               if (currTimeValuePairs.size() > 0) {
@@ -391,11 +390,11 @@ public class CompactionCheckerUtils {
       while ((marker = reader.readMarker()) != MetaMarker.SEPARATOR) {
         switch (marker) {
           case MetaMarker.CHUNK_HEADER:
-          case (byte) (MetaMarker.CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK):
-          case (byte) (MetaMarker.CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK):
+          case MetaMarker.TIME_CHUNK_HEADER:
+          case MetaMarker.VALUE_CHUNK_HEADER:
           case MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER:
-          case (byte) (MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK):
-          case (byte) (MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK):
+          case MetaMarker.ONLY_ONE_PAGE_TIME_CHUNK_HEADER:
+          case MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER:
             ChunkHeader header = reader.readChunkHeader(marker);
             // read the next measurement and pack data of last measurement
             if (pagePointsNum.size() > 0) {
diff --git 
a/server/src/test/java/org/apache/iotdb/db/tools/TsFileSketchToolTest.java 
b/server/src/test/java/org/apache/iotdb/db/tools/TsFileSketchToolTest.java
index 6571ecf..3b5c31f 100644
--- a/server/src/test/java/org/apache/iotdb/db/tools/TsFileSketchToolTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/tools/TsFileSketchToolTest.java
@@ -19,10 +19,12 @@
 
 package org.apache.iotdb.db.tools;
 
+import org.apache.iotdb.tsfile.file.metadata.ChunkGroupMetadata;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
 import org.apache.iotdb.tsfile.read.common.Path;
+import org.apache.iotdb.tsfile.utils.MeasurementGroup;
 import org.apache.iotdb.tsfile.write.TsFileWriter;
 import org.apache.iotdb.tsfile.write.record.Tablet;
 import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
@@ -56,6 +58,12 @@ public class TsFileSketchToolTest {
           .concat("1-0-0-0.tsfile");
   String sketchOut = "sketch.out";
   String device = "root.device_0";
+  String alignedDevice = "root.device_1";
+  String sensorPrefix = "sensor_";
+  // the number of rows to include in the tablet
+  int rowNum = 1000000;
+  // the number of values to include in the tablet
+  int sensorNum = 10;
 
   @Before
   public void setUp() throws Exception {
@@ -67,12 +75,6 @@ public class TsFileSketchToolTest {
 
       Schema schema = new Schema();
 
-      String sensorPrefix = "sensor_";
-      // the number of rows to include in the tablet
-      int rowNum = 1000000;
-      // the number of values to include in the tablet
-      int sensorNum = 10;
-
       List<MeasurementSchema> measurementSchemas = new ArrayList<>();
       // add measurements into file schema (all with INT64 data type)
       for (int i = 0; i < sensorNum; i++) {
@@ -83,19 +85,27 @@ public class TsFileSketchToolTest {
             new Path(device),
             new MeasurementSchema(sensorPrefix + (i + 1), TSDataType.INT64, 
TSEncoding.TS_2DIFF));
       }
+      // add aligned measurements into file schema
+      List<MeasurementSchema> schemas = new ArrayList<>();
+      List<MeasurementSchema> alignedMeasurementSchemas = new ArrayList<>();
+      for (int i = 0; i < sensorNum; i++) {
+        MeasurementSchema schema1 =
+            new MeasurementSchema(sensorPrefix + (i + 1), TSDataType.INT64, 
TSEncoding.RLE);
+        schemas.add(schema1);
+        alignedMeasurementSchemas.add(schema1);
+      }
+      MeasurementGroup group = new MeasurementGroup(true, schemas);
+      schema.registerMeasurementGroup(new Path(alignedDevice), group);
 
-      // add measurements into TSFileWriter
       try (TsFileWriter tsFileWriter = new TsFileWriter(f, schema)) {
 
+        // add measurements into TSFileWriter
         // construct the tablet
         Tablet tablet = new Tablet(device, measurementSchemas);
-
         long[] timestamps = tablet.timestamps;
         Object[] values = tablet.values;
-
         long timestamp = 1;
         long value = 1000000L;
-
         for (int r = 0; r < rowNum; r++, value++) {
           int row = tablet.rowSize++;
           timestamps[row] = timestamp++;
@@ -114,6 +124,32 @@ public class TsFileSketchToolTest {
           tsFileWriter.write(tablet);
           tablet.reset();
         }
+
+        // add aligned measurements into TSFileWriter
+        // construct the tablet
+        tablet = new Tablet(alignedDevice, alignedMeasurementSchemas);
+        timestamps = tablet.timestamps;
+        values = tablet.values;
+        timestamp = 1;
+        value = 1000000L;
+        for (int r = 0; r < rowNum; r++, value++) {
+          int row = tablet.rowSize++;
+          timestamps[row] = timestamp++;
+          for (int i = 0; i < sensorNum; i++) {
+            long[] sensor = (long[]) values[i];
+            sensor[row] = value;
+          }
+          // write Tablet to TsFile
+          if (tablet.rowSize == tablet.getMaxRowNumber()) {
+            tsFileWriter.writeAligned(tablet);
+            tablet.reset();
+          }
+        }
+        // write Tablet to TsFile
+        if (tablet.rowSize != 0) {
+          tsFileWriter.writeAligned(tablet);
+          tablet.reset();
+        }
       }
     } catch (Exception e) {
       throw new Exception("meet error in TsFileWrite with tablet", e);
@@ -122,12 +158,23 @@ public class TsFileSketchToolTest {
 
   @Test
   public void tsFileSketchToolTest() {
-    String args[] = new String[2];
+    String[] args = new String[2];
     args[0] = path;
     args[1] = sketchOut;
     TsFileSketchTool tool = new TsFileSketchTool(path, sketchOut);
     try {
       tool.run();
+      List<ChunkGroupMetadata> chunkGroupMetadataList = 
tool.getAllChunkGroupMetadata();
+      Assert.assertEquals(2, chunkGroupMetadataList.size());
+      for (ChunkGroupMetadata chunkGroupMetadata : chunkGroupMetadataList) {
+        if (device.equals(chunkGroupMetadata.getDevice())) {
+          Assert.assertEquals(sensorNum, 
chunkGroupMetadata.getChunkMetadataList().size());
+        } else if (alignedDevice.equals(chunkGroupMetadata.getDevice())) {
+          Assert.assertEquals(sensorNum + 1, 
chunkGroupMetadata.getChunkMetadataList().size());
+        } else {
+          Assert.fail();
+        }
+      }
     } catch (IOException e) {
       Assert.fail(e.getMessage());
     }
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java
index 70d326d..8825cdc 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/MetaMarker.java
@@ -47,18 +47,22 @@ public class MetaMarker {
   public static final byte ONLY_ONE_PAGE_CHUNK_HEADER = 5;
 
   /** Time Chunk header marker and this chunk has more than one page. */
-  public static final byte TIME_CHUNK_HEADER = (byte) (CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK);
+
+  public static final byte TIME_CHUNK_HEADER =
+      (byte) (CHUNK_HEADER | TsFileConstant.TIME_COLUMN_MASK);
 
   /** Value Chunk header marker and this chunk has more than one page. */
-  public static final byte VALUE_CHUNK_HEADER = (byte) (CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK);
+  public static final byte VALUE_CHUNK_HEADER =
+      (byte) (CHUNK_HEADER | TsFileConstant.VALUE_COLUMN_MASK);
 
   /** Time Chunk header marker and this chunk has only one page. */
-  public static final byte ONLY_ONE_PAGE_TIME_CHUNK_HEADER = (byte) 
(ONLY_ONE_PAGE_CHUNK_HEADER | TsFileConstant.TIME_COLUMN_MASK);
+  public static final byte ONLY_ONE_PAGE_TIME_CHUNK_HEADER =
+      (byte) (ONLY_ONE_PAGE_CHUNK_HEADER | TsFileConstant.TIME_COLUMN_MASK);
 
   /** Value Chunk header marker and this chunk has only one page. */
-  public static final byte ONLY_ONE_PAGE_VALUE_CHUNK_HEADER = (byte) 
(ONLY_ONE_PAGE_CHUNK_HEADER | TsFileConstant.VALUE_COLUMN_MASK);
-
-
+  public static final byte ONLY_ONE_PAGE_VALUE_CHUNK_HEADER =
+      (byte) (ONLY_ONE_PAGE_CHUNK_HEADER | TsFileConstant.VALUE_COLUMN_MASK);
+  
   private MetaMarker() {}
 
   public static void handleUnexpectedMarker(byte marker) throws IOException {
diff --git 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileIOWriterTest.java 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileIOWriterTest.java
index 84e7a1d..4c23219 100644
--- a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileIOWriterTest.java
+++ b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileIOWriterTest.java
@@ -126,20 +126,14 @@ public class TsFileIOWriterTest {
       chunkGroupHeader = reader.readChunkGroupHeader();
       Assert.assertEquals(DEVICE_2, chunkGroupHeader.getDeviceID());
       // vector chunk header (time)
-      Assert.assertEquals(
-          MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.TIME_COLUMN_MASK,
-          reader.readMarker());
+      Assert.assertEquals(MetaMarker.ONLY_ONE_PAGE_TIME_CHUNK_HEADER, 
reader.readMarker());
       header = reader.readChunkHeader(MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER);
       Assert.assertEquals("", header.getMeasurementID());
       // vector chunk header (values)
-      Assert.assertEquals(
-          MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK,
-          reader.readMarker());
+      Assert.assertEquals(MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER, 
reader.readMarker());
       header = reader.readChunkHeader(MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER);
       Assert.assertEquals("s1", header.getMeasurementID());
-      Assert.assertEquals(
-          MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER | 
TsFileConstant.VALUE_COLUMN_MASK,
-          reader.readMarker());
+      Assert.assertEquals(MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER, 
reader.readMarker());
       header = reader.readChunkHeader(MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER);
       Assert.assertEquals("s2", header.getMeasurementID());
     }
diff --git 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/AlignedChunkWriterImplTest.java
 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/AlignedChunkWriterImplTest.java
index 2e756d3..456f9f2 100644
--- 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/AlignedChunkWriterImplTest.java
+++ 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/AlignedChunkWriterImplTest.java
@@ -65,8 +65,7 @@ public class AlignedChunkWriterImplTest {
       PublicBAOS publicBAOS = testTsFileOutput.publicBAOS;
       ByteBuffer buffer = ByteBuffer.wrap(publicBAOS.getBuf(), 0, 
publicBAOS.size());
       // time chunk
-      assertEquals(
-          (byte) (0x80 | MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER), 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.ONLY_ONE_PAGE_TIME_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(164, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.VECTOR.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -75,7 +74,7 @@ public class AlignedChunkWriterImplTest {
       buffer.position(buffer.position() + 164);
 
       // value chunk 1
-      assertEquals(0x40 | MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s1", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(89, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.FLOAT.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -84,7 +83,7 @@ public class AlignedChunkWriterImplTest {
       buffer.position(buffer.position() + 89);
 
       // value chunk 2
-      assertEquals(0x40 | MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s2", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(29, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.INT32.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -93,7 +92,7 @@ public class AlignedChunkWriterImplTest {
       buffer.position(buffer.position() + 29);
 
       // value chunk 2
-      assertEquals(0x40 | MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s3", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(171, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.DOUBLE.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -139,7 +138,7 @@ public class AlignedChunkWriterImplTest {
       PublicBAOS publicBAOS = testTsFileOutput.publicBAOS;
       ByteBuffer buffer = ByteBuffer.wrap(publicBAOS.getBuf(), 0, 
publicBAOS.size());
       // time chunk
-      assertEquals((byte) (0x80 | MetaMarker.CHUNK_HEADER), 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.TIME_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(362, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.VECTOR.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -148,7 +147,7 @@ public class AlignedChunkWriterImplTest {
       buffer.position(buffer.position() + 362);
 
       // value chunk 1
-      assertEquals(0x40 | MetaMarker.CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s1", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(260, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.FLOAT.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -157,7 +156,7 @@ public class AlignedChunkWriterImplTest {
       buffer.position(buffer.position() + 260);
 
       // value chunk 2
-      assertEquals(0x40 | MetaMarker.CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s2", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(140, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.INT32.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -166,7 +165,7 @@ public class AlignedChunkWriterImplTest {
       buffer.position(buffer.position() + 140);
 
       // value chunk 2
-      assertEquals(0x40 | MetaMarker.CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s3", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(456, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.DOUBLE.serialize(), 
ReadWriteIOUtils.readByte(buffer));
diff --git 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/TimeChunkWriterTest.java
 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/TimeChunkWriterTest.java
index bdca8d5..8978c2e 100644
--- 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/TimeChunkWriterTest.java
+++ 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/TimeChunkWriterTest.java
@@ -59,8 +59,7 @@ public class TimeChunkWriterTest {
       chunkWriter.writeAllPagesOfChunkToTsFile(writer);
       PublicBAOS publicBAOS = testTsFileOutput.publicBAOS;
       ByteBuffer buffer = ByteBuffer.wrap(publicBAOS.getBuf(), 0, 
publicBAOS.size());
-      assertEquals(
-          (byte) (0x80 | MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER), 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.ONLY_ONE_PAGE_TIME_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("c1", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(82, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.VECTOR.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -96,7 +95,7 @@ public class TimeChunkWriterTest {
       chunkWriter.writeAllPagesOfChunkToTsFile(writer);
       PublicBAOS publicBAOS = testTsFileOutput.publicBAOS;
       ByteBuffer buffer = ByteBuffer.wrap(publicBAOS.getBuf(), 0, 
publicBAOS.size());
-      assertEquals((byte) (0x80 | MetaMarker.CHUNK_HEADER), 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.TIME_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("c1", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(198, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.VECTOR.serialize(), 
ReadWriteIOUtils.readByte(buffer));
diff --git 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ValueChunkWriterTest.java
 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ValueChunkWriterTest.java
index 3cc8272..27cbec9 100644
--- 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ValueChunkWriterTest.java
+++ 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ValueChunkWriterTest.java
@@ -58,7 +58,7 @@ public class ValueChunkWriterTest {
       chunkWriter.writeAllPagesOfChunkToTsFile(writer);
       PublicBAOS publicBAOS = testTsFileOutput.publicBAOS;
       ByteBuffer buffer = ByteBuffer.wrap(publicBAOS.getBuf(), 0, 
publicBAOS.size());
-      assertEquals(0x40 | MetaMarker.ONLY_ONE_PAGE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.ONLY_ONE_PAGE_VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s1", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(69, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.FLOAT.serialize(), 
ReadWriteIOUtils.readByte(buffer));
@@ -94,7 +94,7 @@ public class ValueChunkWriterTest {
       chunkWriter.writeAllPagesOfChunkToTsFile(writer);
       PublicBAOS publicBAOS = testTsFileOutput.publicBAOS;
       ByteBuffer buffer = ByteBuffer.wrap(publicBAOS.getBuf(), 0, 
publicBAOS.size());
-      assertEquals(0x40 | MetaMarker.CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
+      assertEquals(MetaMarker.VALUE_CHUNK_HEADER, 
ReadWriteIOUtils.readByte(buffer));
       assertEquals("s1", ReadWriteIOUtils.readVarIntString(buffer));
       assertEquals(220, ReadWriteForEncodingUtils.readUnsignedVarInt(buffer));
       assertEquals(TSDataType.FLOAT.serialize(), 
ReadWriteIOUtils.readByte(buffer));

Reply via email to