You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/03/16 06:52:04 UTC

[iotdb] 01/02: RawQueryDatasetWithoutValueFilter

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

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

commit 67f533610062ffd428f124990aa791120d7af0d7
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Tue Mar 16 14:49:33 2021 +0800

    RawQueryDatasetWithoutValueFilter
---
 .../dataset/RawQueryDataSetWithoutValueFilter.java | 26 ++++++++++++++--------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java b/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java
index b4150bb..814aa27 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java
@@ -146,6 +146,8 @@ public class RawQueryDataSetWithoutValueFilter extends QueryDataSet
 
   protected BatchData[] cachedBatchDataArray;
 
+  private int bufferNum;
+
   // capacity for blocking queue
   private static final int BLOCKING_QUEUE_CAPACITY = 5;
 
@@ -179,6 +181,14 @@ public class RawQueryDataSetWithoutValueFilter extends QueryDataSet
     }
     cachedBatchDataArray = new BatchData[readers.size()];
     noMoreDataInQueueArray = new boolean[readers.size()];
+    bufferNum = 0;
+    for (int index = 0; index < paths.size(); index++) {
+      if (paths.get(index) instanceof VectorPartialPath) {
+        bufferNum += ((VectorPartialPath) paths).getSubSensorsPathList().size();
+      } else {
+        bufferNum += 1;
+      }
+    }
     init();
   }
 
@@ -215,14 +225,7 @@ public class RawQueryDataSetWithoutValueFilter extends QueryDataSet
     TSQueryDataSet tsQueryDataSet = new TSQueryDataSet();
 
     PublicBAOS timeBAOS = new PublicBAOS();
-    int bufferNum = 0;
-    for (int index = 0; index < seriesNum; index++) {
-      if (paths.get(index) instanceof VectorPartialPath) {
-        bufferNum += ((VectorPartialPath) paths).getSubSensorsPathList().size();
-      } else {
-        bufferNum += 1;
-      }
-    }
+
     PublicBAOS[] valueBAOSList = new PublicBAOS[bufferNum];
     PublicBAOS[] bitmapBAOSList = new PublicBAOS[bufferNum];
 
@@ -254,7 +257,7 @@ public class RawQueryDataSetWithoutValueFilter extends QueryDataSet
           // current batch is empty or does not have value at minTime
           if (rowOffset == 0) {
             if (paths.get(seriesIndex) instanceof VectorPartialPath) {
-              for (int i = 0; i < ((VectorPartialPath) paths).getSubSensorsPathList().size(); i++) {
+              for (int i = 0; i < ((VectorPartialPath) paths.get(seriesIndex)).getSubSensorsPathList().size(); i++) {
                 currentBitmapList[bufferIndex] = (currentBitmapList[bufferIndex] << 1);
                 bufferIndex++;
               }
@@ -318,6 +321,11 @@ public class RawQueryDataSetWithoutValueFilter extends QueryDataSet
                 break;
               case VECTOR:
                 for (TsPrimitiveType primitiveVal : cachedBatchDataArray[seriesIndex].getVector()) {
+                  if (primitiveVal == null) {
+                    currentBitmapList[bufferIndex] = (currentBitmapList[bufferIndex] << 1);
+                    bufferIndex++;
+                    continue;
+                  }
                   currentBitmapList[bufferIndex] = (currentBitmapList[bufferIndex] << 1) | FLAG;
                   switch (primitiveVal.getDataType()) {
                     case INT32: