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

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


The following commit(s) were added to refs/heads/QueryMetrics0.13 by this push:
     new 1d55bde9a6 optimize page reader
1d55bde9a6 is described below

commit 1d55bde9a60ef31adbb5f935b09dd6d2d2b33d67
Author: JackieTien97 <[email protected]>
AuthorDate: Fri Nov 11 17:49:04 2022 +0800

    optimize page reader
---
 .../iotdb/tsfile/read/reader/page/PageReader.java  | 51 ++++++++++++++--------
 1 file changed, 33 insertions(+), 18 deletions(-)

diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java
index cb600f3e31..f09b6a23b9 100644
--- 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java
+++ 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/PageReader.java
@@ -106,48 +106,63 @@ public class PageReader implements IPageReader {
   public BatchData getAllSatisfiedPageData(boolean ascending) throws 
IOException {
     BatchData pageData = BatchDataFactory.createBatchData(dataType, ascending, 
false);
     if (filter == null || filter.satisfy(getStatistics())) {
-      while (timeDecoder.hasNext(timeBuffer)) {
-        long timestamp = timeDecoder.readLong(timeBuffer);
-        switch (dataType) {
-          case BOOLEAN:
+      switch (dataType) {
+        case BOOLEAN:
+          while (timeDecoder.hasNext(timeBuffer)) {
+            long timestamp = timeDecoder.readLong(timeBuffer);
             boolean aBoolean = valueDecoder.readBoolean(valueBuffer);
             if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, aBoolean))) {
               pageData.putBoolean(timestamp, aBoolean);
             }
-            break;
-          case INT32:
+          }
+          break;
+        case INT32:
+          while (timeDecoder.hasNext(timeBuffer)) {
+            long timestamp = timeDecoder.readLong(timeBuffer);
             int anInt = valueDecoder.readInt(valueBuffer);
             if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, anInt))) {
               pageData.putInt(timestamp, anInt);
             }
-            break;
-          case INT64:
+          }
+          break;
+        case INT64:
+          while (timeDecoder.hasNext(timeBuffer)) {
+            long timestamp = timeDecoder.readLong(timeBuffer);
             long aLong = valueDecoder.readLong(valueBuffer);
             if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, aLong))) {
               pageData.putLong(timestamp, aLong);
             }
-            break;
-          case FLOAT:
+          }
+          break;
+        case FLOAT:
+          while (timeDecoder.hasNext(timeBuffer)) {
+            long timestamp = timeDecoder.readLong(timeBuffer);
             float aFloat = valueDecoder.readFloat(valueBuffer);
             if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, aFloat))) {
               pageData.putFloat(timestamp, aFloat);
             }
-            break;
-          case DOUBLE:
+          }
+          break;
+        case DOUBLE:
+          while (timeDecoder.hasNext(timeBuffer)) {
+            long timestamp = timeDecoder.readLong(timeBuffer);
             double aDouble = valueDecoder.readDouble(valueBuffer);
             if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, aDouble))) {
               pageData.putDouble(timestamp, aDouble);
             }
-            break;
-          case TEXT:
+          }
+          break;
+        case TEXT:
+          while (timeDecoder.hasNext(timeBuffer)) {
+            long timestamp = timeDecoder.readLong(timeBuffer);
             Binary aBinary = valueDecoder.readBinary(valueBuffer);
             if (!isDeleted(timestamp) && (filter == null || 
filter.satisfy(timestamp, aBinary))) {
               pageData.putBinary(timestamp, aBinary);
             }
-            break;
-          default:
-            throw new UnSupportedDataTypeException(String.valueOf(dataType));
-        }
+          }
+          break;
+        default:
+          throw new UnSupportedDataTypeException(String.valueOf(dataType));
       }
     }
     return pageData.flip();

Reply via email to