mychaow commented on a change in pull request #2029:
URL: https://github.com/apache/iotdb/pull/2029#discussion_r524905230



##########
File path: 
server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByEngineDataSet.java
##########
@@ -70,36 +77,69 @@ public GroupByEngineDataSet(QueryContext context, 
GroupByTimePlan groupByTimePla
       long intervalNum = (long) Math.ceil(queryRange / (double) slidingStep);
       curStartTime = slidingStep * (intervalNum - 1) + startTime;
     }
-    curEndTime = Math.min(curStartTime + interval, endTime);
+
+    //if is group by months interval and sliding step are calculated in ms by 
* 30 * 86400_000L
+    //now converting them back to integer months
+    if (isIntervalByMonth) {
+      interval = interval / 30 / 86400_000L;

Review comment:
       define the number to a const variable

##########
File path: 
server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByEngineDataSet.java
##########
@@ -70,36 +77,69 @@ public GroupByEngineDataSet(QueryContext context, 
GroupByTimePlan groupByTimePla
       long intervalNum = (long) Math.ceil(queryRange / (double) slidingStep);
       curStartTime = slidingStep * (intervalNum - 1) + startTime;
     }
-    curEndTime = Math.min(curStartTime + interval, endTime);
+
+    //if is group by months interval and sliding step are calculated in ms by 
* 30 * 86400_000L
+    //now converting them back to integer months
+    if (isIntervalByMonth) {
+      interval = interval / 30 / 86400_000L;
+      curEndTime = Math.min(curStartTime + calcIntervalByMonth(interval, 
curStartTime), endTime);

Review comment:
       Please add some comments about the implement. You could list some 
example to explain it. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to