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 2023/08/02 01:11:51 UTC

[iotdb] branch count_time updated: fix bug in CountTimeAccumulator

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

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


The following commit(s) were added to refs/heads/count_time by this push:
     new 1c9a903b22f fix bug in CountTimeAccumulator
1c9a903b22f is described below

commit 1c9a903b22f2b211273871ef86bad0c591755c47
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Wed Aug 2 09:11:42 2023 +0800

    fix bug in CountTimeAccumulator
---
 .../execution/aggregation/CountTimeAccumulator.java           | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/CountTimeAccumulator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/CountTimeAccumulator.java
index e29a3b63ca9..6cffec5e5d0 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/CountTimeAccumulator.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/CountTimeAccumulator.java
@@ -38,7 +38,16 @@ public class CountTimeAccumulator implements Accumulator {
   // Column should be like: | Time | Time |
   @Override
   public void addInput(Column[] column, BitMap bitMap, int lastIndex) {
-    countValue += column[0].getPositionCount();
+
+    if ((bitMap == null) || bitMap.isAllMarked()) {
+      countValue += (lastIndex + 1);
+    } else {
+      for (int i = 0; i <= lastIndex; i++) {
+        if (bitMap.isMarked(i)) {
+          countValue++;
+        }
+      }
+    }
   }
 
   // partialResult should be like: | partialCountValue1 |