iotdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qiaojia...@apache.org
Subject [incubator-iotdb] 02/02: [IOTDB-327] fix group by (#596)
Date Mon, 02 Dec 2019 08:36:47 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 7598f9fd10e2ed594d2d2144375074840c73ff2b
Author: SilverNarcissus <151250176@smail.nju.edu.cn>
AuthorDate: Mon Dec 2 16:34:24 2019 +0800

    [IOTDB-327] fix group by (#596)
    
    * fix bug in group by
    
    (cherry picked from commit c300fc6c7bf40f67bdaf6848c5a885630726a72a)
---
 .../db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java  | 6 ++++++
 .../test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java   | 1 +
 2 files changed, 7 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java
index 9ca26ed..6b70c9a 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java
@@ -39,6 +39,7 @@ import org.apache.iotdb.tsfile.read.common.BatchData;
 import org.apache.iotdb.tsfile.read.common.Field;
 import org.apache.iotdb.tsfile.read.common.Path;
 import org.apache.iotdb.tsfile.read.common.RowRecord;
+import org.apache.iotdb.tsfile.read.common.TimeRange;
 import org.apache.iotdb.tsfile.read.expression.IExpression;
 import org.apache.iotdb.tsfile.read.expression.impl.GlobalTimeExpression;
 import org.apache.iotdb.tsfile.read.filter.basic.Filter;
@@ -307,6 +308,11 @@ public class GroupByWithoutValueFilterDataSet extends GroupByEngineDataSet
{
       return false;
     }
 
+    TimeRange range = new TimeRange(startTime, endTime - 1);
+    if (!range.contains(new TimeRange(minTime, maxTime))) {
+      return false;
+    }
+
     // cal unsequence data with timestamps between pages.
     function.calculateValueFromUnsequenceReader(unSequenceReader, minTime);
 
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java
index f39fd8d..01e9e0c 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java
@@ -67,6 +67,7 @@ public class IOTDBGroupByIT {
           + "values(100, 100.1, false, 110)",
       "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
           + "values(150, 200.2, true, 220)",
+      "flush",
       "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
           + "values(200, 300.3, false, 330 )",
       "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "


Mime
View raw message