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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java:
##########
@@ -1535,22 +1539,35 @@ private GroupByTimeComponent parseGroupByTimeClause(
     }
 
     // Parse time interval
-    groupByTimeComponent.setInterval(
-        parseTimeIntervalOrSlidingStep(ctx.interval.getText(), true, 
groupByTimeComponent));
-    if (groupByTimeComponent.getInterval() <= 0) {
+    
groupByTimeComponent.setInterval(DateTimeUtils.constructTimeDuration(ctx.interval.getText()));
+    groupByTimeComponent.setOriginalInterval(ctx.interval.getText());
+    if (groupByTimeComponent.getInterval().monthDuration == 0
+        && groupByTimeComponent.getInterval().nonMonthDuration == 0) {
       throw new SemanticException(
           "The second parameter time interval should be a positive integer.");
     }
 
     // parse sliding step
     if (ctx.step != null) {
-      groupByTimeComponent.setSlidingStep(
-          parseTimeIntervalOrSlidingStep(ctx.step.getText(), false, 
groupByTimeComponent));
+      
groupByTimeComponent.setSlidingStep(DateTimeUtils.constructTimeDuration(ctx.step.getText()));
+      groupByTimeComponent.setOriginalInterval(ctx.step.getText());
     } else {
       groupByTimeComponent.setSlidingStep(groupByTimeComponent.getInterval());
-      
groupByTimeComponent.setSlidingStepByMonth(groupByTimeComponent.isIntervalByMonth());
+      
groupByTimeComponent.setOriginalInterval(groupByTimeComponent.getOriginalInterval());
+    }
+    TimeDuration slidingStep = groupByTimeComponent.getSlidingStep();
+    if (slidingStep.containsMonth()
+        && Math.ceil(
+                ((groupByTimeComponent.getEndTime() - 
groupByTimeComponent.getStartTime())
+                    / (double) slidingStep.getMinTotalDuration(currPrecision)))
+            >= 10000) {
+      throw new SemanticException("The time windows may exceed 10000, please 
ensure your input.");
+    }

Review Comment:
   > Is this necessary?
   
   Yes, we need to maintain a long array of this length in 
`GroupByMonthFilter`,  limit here is to avoid OOM caused by incorrect user 
input.



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