You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ea...@apache.org on 2019/02/28 02:29:26 UTC

[incubator-iotdb] branch east_fixbug updated: update

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

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


The following commit(s) were added to refs/heads/east_fixbug by this push:
     new c333aa0  update
c333aa0 is described below

commit c333aa0e8b69b81b6e700455d18e69175320b60e
Author: mdf369 <95...@qq.com>
AuthorDate: Thu Feb 28 10:29:07 2019 +0800

    update
---
 .../iotdb/tsfile/file/header/PageHeader.java       |  7 +-
 .../file/metadata/statistics/Statistics.java       | 92 ----------------------
 .../iotdb/tsfile/read/TsFileSequenceReader.java    |  6 +-
 3 files changed, 7 insertions(+), 98 deletions(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java
index 192d8ca..101a1ac 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/header/PageHeader.java
@@ -58,7 +58,7 @@ public class PageHeader {
   }
 
   public static int calculatePageHeaderSize(TSDataType type) {
-    return 3 * Integer.BYTES + 2 * Long.BYTES + Statistics.getStatsByType(type).getSerializedSize();
+    return calculatePageHeaderSizeWithoutStatistics() + Statistics.getStatsByType(type).getSerializedSize();
   }
 
   public static int calculatePageHeaderSizeWithoutStatistics() {
@@ -92,14 +92,15 @@ public class PageHeader {
   /**
    * deserialize from FileChannel.
    *
+   * @param dataType data type
    * @param channel FileChannel
    * @param offset offset
    * @param markerRead read marker (boolean type)
-   * @param dataType data type
    * @return CHUNK_HEADER object
    * @throws IOException IOException
    */
-  public static PageHeader deserializeFrom(FileChannel channel, long offset, boolean markerRead, TSDataType dataType)
+  public static PageHeader deserializeFrom(TSDataType dataType, FileChannel channel, long offset,
+      boolean markerRead)
       throws IOException {
     long offsetVar = offset;
     if (!markerRead) {
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java
index dc73637..6bbfe7f 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/statistics/Statistics.java
@@ -335,96 +335,4 @@ public abstract class Statistics<T> {
     }
     return length;
   }
-
-  public static void main(String[] args) throws IOException {
-    Statistics statistics = new BinaryStatistics();
-    statistics.fill(new FileChannel() {
-      @Override
-      public int read(ByteBuffer dst) throws IOException {
-        return 0;
-      }
-
-      @Override
-      public long read(ByteBuffer[] dsts, int offset, int length) throws IOException {
-        return 0;
-      }
-
-      @Override
-      public int write(ByteBuffer src) throws IOException {
-        return 0;
-      }
-
-      @Override
-      public long write(ByteBuffer[] srcs, int offset, int length) throws IOException {
-        return 0;
-      }
-
-      @Override
-      public long position() throws IOException {
-        return 0;
-      }
-
-      @Override
-      public FileChannel position(long newPosition) throws IOException {
-        return null;
-      }
-
-      @Override
-      public long size() throws IOException {
-        return 0;
-      }
-
-      @Override
-      public FileChannel truncate(long size) throws IOException {
-        return null;
-      }
-
-      @Override
-      public void force(boolean metaData) throws IOException {
-
-      }
-
-      @Override
-      public long transferTo(long position, long count, WritableByteChannel target)
-          throws IOException {
-        return 0;
-      }
-
-      @Override
-      public long transferFrom(ReadableByteChannel src, long position, long count)
-          throws IOException {
-        return 0;
-      }
-
-      @Override
-      public int read(ByteBuffer dst, long position) throws IOException {
-        return 0;
-      }
-
-      @Override
-      public int write(ByteBuffer src, long position) throws IOException {
-        return 0;
-      }
-
-      @Override
-      public MappedByteBuffer map(MapMode mode, long position, long size) throws IOException {
-        return null;
-      }
-
-      @Override
-      public FileLock lock(long position, long size, boolean shared) throws IOException {
-        return null;
-      }
-
-      @Override
-      public FileLock tryLock(long position, long size, boolean shared) throws IOException {
-        return null;
-      }
-
-      @Override
-      protected void implCloseChannel() throws IOException {
-
-      }
-    }, 0);
-  }
 }
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
index fa673ba..b66fe38 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
@@ -255,12 +255,12 @@ public class TsFileSequenceReader {
   /**
    * read the page's header.
    *
+   * @param dataType given tsfile data type
    * @param position the file offset of this chunk's header
    * @param markerRead true if the offset does not contains the marker , otherwise false
-   * @param dataType given tsfile data type
    */
-  private PageHeader readPageHeader(long position, boolean markerRead, TSDataType dataType) throws IOException {
-    return PageHeader.deserializeFrom(tsFileInput.wrapAsFileChannel(), position, markerRead, dataType);
+  private PageHeader readPageHeader(TSDataType dataType, long position, boolean markerRead) throws IOException {
+    return PageHeader.deserializeFrom(dataType, tsFileInput.wrapAsFileChannel(), position, markerRead);
   }
 
   public long position() throws IOException {