You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/12/06 01:42:06 UTC

[iotdb] 06/07: add getAllSatisfiedDataWithoutModified

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

hui pushed a commit to branch lmh/OptSingleGroupby
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 90b171dbca2ca54884678a451121b5589457ff34
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Tue Dec 6 09:36:15 2022 +0800

    add getAllSatisfiedDataWithoutModified
---
 .../tsfile/read/reader/page/ValuePageReader.java   | 69 +++++++++++++++++++++-
 1 file changed, 67 insertions(+), 2 deletions(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/ValuePageReader.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/ValuePageReader.java
index 45729ec05e..195b57f4d6 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/ValuePageReader.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/reader/page/ValuePageReader.java
@@ -328,6 +328,67 @@ public class ValuePageReader {
     }
   }
 
+  public void writeColumnBuilderWithNextBatch(
+      long[] timeBatch, ColumnBuilder columnBuilder, boolean[] keepCurrentRow) {
+    if (valueBuffer == null) {
+      for (int i = 0, n = timeBatch.length; i < n; i++) {
+        if (keepCurrentRow[i]) {
+          columnBuilder.appendNull();
+        }
+      }
+      return;
+    }
+
+    for (int i = 0, n = timeBatch.length; i < n; i++) {
+      if (((bitmap[i / 8] & 0xFF) & (MASK >>> (i % 8))) == 0) {
+        if (keepCurrentRow[i]) {
+          columnBuilder.appendNull();
+        }
+        continue;
+      }
+      switch (dataType) {
+        case BOOLEAN:
+          boolean aBoolean = valueDecoder.readBoolean(valueBuffer);
+          if (keepCurrentRow[i]) {
+            columnBuilder.writeBoolean(aBoolean);
+          }
+          break;
+        case INT32:
+          int anInt = valueDecoder.readInt(valueBuffer);
+          if (keepCurrentRow[i]) {
+            columnBuilder.writeInt(anInt);
+          }
+          break;
+        case INT64:
+          long aLong = valueDecoder.readLong(valueBuffer);
+          if (keepCurrentRow[i]) {
+            columnBuilder.writeLong(aLong);
+          }
+          break;
+        case FLOAT:
+          float aFloat = valueDecoder.readFloat(valueBuffer);
+          if (keepCurrentRow[i]) {
+            columnBuilder.writeFloat(aFloat);
+          }
+          break;
+        case DOUBLE:
+          double aDouble = valueDecoder.readDouble(valueBuffer);
+          if (keepCurrentRow[i]) {
+            columnBuilder.writeDouble(aDouble);
+          }
+          break;
+        case TEXT:
+          Binary aBinary = valueDecoder.readBinary(valueBuffer);
+          if (keepCurrentRow[i]) {
+            columnBuilder.writeBinary(aBinary);
+          }
+          break;
+        default:
+          throw new UnSupportedDataTypeException(String.valueOf(dataType));
+      }
+    }
+  }
+
   public Statistics getStatistics() {
     return pageHeader.getStatistics();
   }
@@ -358,8 +419,12 @@ public class ValuePageReader {
   }
 
   public void fillIsDeleted(long[] timestamp, boolean[] isDeleted) {
-    for (int i = 0, n = timestamp.length; i < n; i++) {
-      isDeleted[i] = isDeleted(timestamp[i]);
+    if (deleteIntervalList == null) {
+      Arrays.fill(isDeleted, false);
+    } else {
+      for (int i = 0, n = timestamp.length; i < n; i++) {
+        isDeleted[i] = isDeleted(timestamp[i]);
+      }
     }
   }