JackieTien97 commented on code in PR #12393:
URL: https://github.com/apache/iotdb/pull/12393#discussion_r1590950784


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/last/LastQueryOperator.java:
##########
@@ -173,4 +178,15 @@ public long calculateRetainedSizeAfterCallingNext() {
     }
     return max;
   }
+
+  @Override
+  public long getEstimatedMemoryUsageInBytes() {

Review Comment:
   You should think about the memory size of `tsBlockBuilder` field.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/last/UpdateLastCacheOperator.java:
##########
@@ -89,4 +94,14 @@ protected void appendLastValueToTsBlockBuilder(long 
lastTime, TsPrimitiveType la
     LastQueryUtil.appendLastValue(
         tsBlockBuilder, lastTime, fullPath.getFullPath(), 
lastValue.getStringValue(), dataType);
   }
+
+  @Override
+  public long getEstimatedMemoryUsageInBytes() {
+    return INSTANCE_SIZE

Review Comment:
   where did you add the class size of `MeasurementPath` since you only add 
`EstimatedSizeOfPartialPathWithoutClassSize` here.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java:
##########
@@ -2947,6 +2949,18 @@ public List<Operator> 
dealWithConsumeAllChildrenPipelineBreaker(
       for (PlanNode localChild : node.getChildren()) {
         Operator childOperation = localChild.accept(this, context);
         parentPipelineChildren.add(childOperation);
+        // if we don't create extra pipeline, the root of the child pipeline 
should be current root
+        // for example, we have IdentitySinkNode -> DeviceViewNode -> 
[ScanNode, ScanNode, ScanNode]
+        // the parent of the pipeline of ScanNode should be IdentitySinkNode 
in the map, otherwise
+        // we will lose the information of these pipelines
+        List<PipelineMemoryEstimator> childPipelineMemoryEstimators =
+            
context.getParentPlanNodeIdToMemoryEstimator().get(localChild.getPlanNodeId());
+        if (childPipelineMemoryEstimators != null) {
+          
context.getParentPlanNodeIdToMemoryEstimator().remove(localChild.getPlanNodeId());
+          context
+              .getParentPlanNodeIdToMemoryEstimator()
+              .put(node.getPlanNodeId(), childPipelineMemoryEstimators);
+        }

Review Comment:
   What does this mean, and the case is incorrect, because `DeviceViewNode` 
won't appear in `dealWithConsumeAllChildrenPipelineBreaker`.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/LastCacheScanOperator.java:
##########
@@ -83,4 +87,11 @@ public long calculateRetainedSizeAfterCallingNext() {
   public PlanNodeId getSourceId() {
     return sourceId;
   }
+
+  @Override
+  public long getEstimatedMemoryUsageInBytes() {
+    return INSTANCE_SIZE

Review Comment:
   also think about the memory usage of `tsBlock` field.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/last/LastQueryTransformOperator.java:
##########
@@ -117,4 +122,13 @@ public void close() throws Exception {
     }
     tsBlockBuilder = null;
   }
+
+  @Override
+  public long getEstimatedMemoryUsageInBytes() {

Review Comment:
   also think about `tsBlockBuilder` field's memory size.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/MemoryMeasurable.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.queryengine.execution;
+
+public interface MemoryMeasurable {

Review Comment:
   what's the difference with `Accountable` interface.



-- 
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: reviews-unsubscr...@iotdb.apache.org

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

Reply via email to