You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/12/01 13:20:39 UTC

[iotdb] branch rel/0.11 updated: division by zero bug, when endtime - starttime < interval

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

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


The following commit(s) were added to refs/heads/rel/0.11 by this push:
     new c38e579  division by zero bug, when endtime - starttime < interval
c38e579 is described below

commit c38e579848e4d0acc15096b0be8ff6cfe29f0480
Author: Haimei Guo <ke...@gmail.com>
AuthorDate: Tue Nov 17 12:16:39 2020 +0800

    division by zero bug, when endtime - starttime < interval
    
    (cherry picked from commit a40842eccced325bc574e724cf8677fc0af3946a)
---
 .../java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
index 0e27a8f..d7863c8 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
@@ -687,8 +687,10 @@ public class PhysicalGenerator {
     if (queryPlan instanceof GroupByTimePlan) {
       GroupByTimePlan plan = (GroupByTimePlan) queryPlan;
       // the actual row number of group by query should be calculated from startTime, endTime and interval.
-      fetchSize = Math
-          .min((int) ((plan.getEndTime() - plan.getStartTime()) / plan.getInterval()), fetchSize);
+      long interval = (plan.getEndTime() - plan.getStartTime()) / plan.getInterval();
+      if (interval > 0) {
+        fetchSize = Math.min((int) (interval), fetchSize);
+      }
     } else if (queryPlan instanceof AggregationPlan) {
       // the actual row number of aggregation query is 1
       fetchSize = 1;