You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/11/17 06:35:36 UTC

[GitHub] [iotdb] mychaow commented on a change in pull request #2029: [IOTDB-825] aggregation by natural month

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:
users@infra.apache.org