You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ch...@apache.org on 2020/11/23 09:26:21 UTC

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

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a40842e  division by zero bug, when endtime - starttime < interval
     new d5df5c5  Merge pull request #2060 from haimeiguo/master_division_by_zero_bug
a40842e is described below

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

    division by zero bug, when endtime - starttime < interval
---
 .../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 0044134..eef2195 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;