Wei-hao-Li commented on code in PR #11429:
URL: https://github.com/apache/iotdb/pull/11429#discussion_r1378537946


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/timerangeiterator/AggrWindowIterator.java:
##########
@@ -92,24 +87,31 @@ private TimeRange getRightmostTimeRange() {
     long queryRange = endTime - startTime;
     long intervalNum;
 
-    if (isSlidingStepByMonth) {
-      intervalNum = (long) Math.ceil(queryRange / (double) (slidingStep * 
MS_TO_MONTH));
-      retStartTime = DateTimeUtils.calcIntervalByMonth(startTime, intervalNum 
* slidingStep);
+    if (slidingStep.containsMonth()) {
+      intervalNum =
+          (long)
+              Math.ceil(
+                  queryRange
+                      / (double)
+                          
(slidingStep.getMaxTotalDuration(TimestampPrecisionUtils.currPrecision)));

Review Comment:
   > I am not very familiar with this part of the code, so I wonder why use 
getMaxTotalDuration here? Will there be a problem if 1 month has less than 31 
days?
   There's something missing here, and it's supposed to be same process as 
`getTotalIntervalNum()`. I will change these codes to call  method 
`getTotalIntervalNum()` here.
   <img width="836" alt="image" 
src="https://github.com/apache/iotdb/assets/60659567/75a3115c-e556-4111-acfb-e0d9e0522993";>
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to