You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/08/11 12:28:27 UTC

[iotdb] 03/09: memory control for SlidingWindowAggregationOperator

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

hui pushed a commit to branch lmh/AggOpMemoryControl
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 7fc64e99a042b8782d0c547568ac5866ee4cf375
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Wed Aug 10 11:32:49 2022 +0800

    memory control for SlidingWindowAggregationOperator
---
 .../operator/process/SlidingWindowAggregationOperator.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/SlidingWindowAggregationOperator.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/SlidingWindowAggregationOperator.java
index 10303016c5..9f1050772c 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/SlidingWindowAggregationOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/SlidingWindowAggregationOperator.java
@@ -30,6 +30,7 @@ import java.util.List;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static org.apache.iotdb.db.mpp.execution.operator.AggregationUtil.initTimeRangeIterator;
+import static org.apache.iotdb.tsfile.read.common.block.TsBlockBuilderStatus.DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES;
 
 public class SlidingWindowAggregationOperator extends SingleInputAggregationOperator {
 
@@ -104,4 +105,14 @@ public class SlidingWindowAggregationOperator extends SingleInputAggregationOper
     }
     curSubTimeRange = null;
   }
+
+  @Override
+  public long calculateMaxPeekMemory() {
+    return calculateMaxReturnSize() + child.calculateMaxReturnSize();
+  }
+
+  @Override
+  public long calculateMaxReturnSize() {
+    return 2L * DEFAULT_MAX_TSBLOCK_SIZE_IN_BYTES;
+  }
 }