You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/03/05 09:28:07 UTC

[iotdb] branch master updated: Fix the sketch tool in new tsfile format (#2775)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 371b852  Fix the sketch tool in new tsfile format (#2775)
371b852 is described below

commit 371b8526c2778a4269ff17e44565038a88313d3b
Author: Jackie Tien <Ja...@foxmail.com>
AuthorDate: Fri Mar 5 17:27:42 2021 +0800

    Fix the sketch tool in new tsfile format (#2775)
---
 .../src/main/java/org/apache/iotdb/db/tools/TsFileSketchTool.java   | 6 ++++--
 .../java/org/apache/iotdb/tsfile/read/reader/LocalTsFileInput.java  | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

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 35cb5ae..c33d2ac 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
@@ -116,12 +116,14 @@ public class TsFileSketchTool {
                     + String.format("%20s", "")
                     + " \t"
                     + chunkMetadata.getStatistics());
-            printlnBoth(pw, String.format("%20s", "") + "|\t\t[marker] 1");
+            printlnBoth(
+                pw,
+                String.format("%20s", "") + "|\t\t[marker] " + chunk.getHeader().getChunkType());
             nextChunkGroupHeaderPos =
                 chunkMetadata.getOffsetOfChunkHeader()
                     + chunk.getHeader().getSerializedSize()
                     + chunk.getHeader().getDataSize()
-                    - 1;
+                    + 17; // skip the PlanIndex
           }
 
           printlnBoth(pw, str1 + "\t[Chunk Group] of " + chunkGroupMetadata.getDevice() + " ends");
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/LocalTsFileInput.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/LocalTsFileInput.java
index 26bd2cf..eb68160 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/LocalTsFileInput.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/LocalTsFileInput.java
@@ -144,6 +144,7 @@ public class LocalTsFileInput implements TsFileInput {
     int varIntLength = ReadWriteForEncodingUtils.varIntSize(strLength);
     byte[] bytes = new byte[strLength];
     channel.read(strBuffer, offset + varIntLength);
+    strBuffer.flip();
     strBuffer.get(bytes, 0, strLength);
     return new String(bytes, 0, strLength);
   }