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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/sink/IdentitySinkOperator.java:
##########
@@ -38,6 +38,9 @@ public class IdentitySinkOperator implements Operator {
       RamUsageEstimator.shallowSizeOfInstance(IdentitySinkOperator.class)
           + 
RamUsageEstimator.shallowSizeOfInstance(DownStreamChannelIndex.class);
 
+  public static final String OUTPUT_PLAN_NODE_ID = "OutputPlanNodeId";

Review Comment:
   ```suggestion
     public static final String DOWNSTREAM_PLAN_NODE_ID = 
"DownStreamPlanNodeId";
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java:
##########
@@ -109,11 +110,16 @@ public BatchData getAllSatisfiedPageData(boolean 
ascending) throws IOException {
 
   @Override
   public TsBlock getAllSatisfiedData() {
+    return getAllSatisfiedData(null);
+  }
+
+  @Override
+  public TsBlock getAllSatisfiedData(Consumer<Long> filterRowsRecorder) {

Review Comment:
   ```suggestion
     public TsBlock getAllSatisfiedData(LongConsumer filterRowsRecorder) {
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/metadata/ChunkMetadataLoaderUtils.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.storageengine.dataregion.read.reader.chunk.metadata;
+
+import org.apache.iotdb.db.queryengine.execution.fragment.QueryContext;
+
+import org.apache.tsfile.file.metadata.IChunkMetadata;
+import org.apache.tsfile.read.filter.basic.Filter;
+
+public class ChunkMetadataLoaderUtils {
+
+  private ChunkMetadataLoaderUtils() {}
+
+  public static boolean shouldSkipAndRecord(

Review Comment:
   add comments about return value



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemPageReader.java:
##########
@@ -122,11 +122,16 @@ public BatchData getAllSatisfiedPageData(boolean 
ascending) throws IOException {
 
   @Override
   public TsBlock getAllSatisfiedData() {
+    return getAllSatisfiedData(null);
+  }
+
+  @Override
+  public TsBlock getAllSatisfiedData(Consumer<Long> filterRowsRecorder) {

Review Comment:
   ```suggestion
     public TsBlock getAllSatisfiedData(LongConsumer filterRowsRecorder) {
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/MultiAlignedTVListIterator.java:
##########
@@ -269,13 +274,18 @@ public TsBlock nextBatch() {
     }
     TsBlock tsBlock = builder.build();
     if (pushDownFilter != null) {
+      Consumer<Long> filterRowsRecorder =
+          this.getQueryContext().isVerbose()
+              ? s -> 
this.getQueryContext().getQueryStatistics().addFilteredRowsOfRowLevel(s)

Review Comment:
   ```suggestion
                 ? 
this.getQueryContext().getQueryStatistics()::addFilteredRowsOfRowLevel
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/ExchangeOperator.java:
##########
@@ -30,11 +30,15 @@
 import org.apache.tsfile.read.common.block.TsBlock;
 import org.apache.tsfile.utils.RamUsageEstimator;
 
+import java.util.Map;
+
 public class ExchangeOperator implements SourceOperator {
 
   private static final long INSTANCE_SIZE =
       RamUsageEstimator.shallowSizeOfInstance(ExchangeOperator.class);
 
+  public static final String SIZE_IN_BYTES = "sizeInBytes";
+

Review Comment:
   change `Map<String, String> specifiedInfo` to `Map<String, Object>` and then 
convert it to `Map<String, String>` in 
`FragmentInstanceExecution.setOperatorStatistics` while constructing 
`TOperatorStatistics`



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/MultiAlignedTVListIterator.java:
##########
@@ -269,13 +274,18 @@ public TsBlock nextBatch() {
     }
     TsBlock tsBlock = builder.build();
     if (pushDownFilter != null) {
+      Consumer<Long> filterRowsRecorder =

Review Comment:
   ```suggestion
         LongConsumer filterRowsRecorder =
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/ExchangeOperator.java:
##########
@@ -30,11 +30,15 @@
 import org.apache.tsfile.read.common.block.TsBlock;
 import org.apache.tsfile.utils.RamUsageEstimator;
 
+import java.util.Map;
+
 public class ExchangeOperator implements SourceOperator {
 
   private static final long INSTANCE_SIZE =
       RamUsageEstimator.shallowSizeOfInstance(ExchangeOperator.class);
 
+  public static final String SIZE_IN_BYTES = "sizeInBytes";
+

Review Comment:
   private final AtomicLong receivedSizeInBytes = new AtomicLong(0);



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/ExchangeOperator.java:
##########
@@ -30,11 +30,15 @@
 import org.apache.tsfile.read.common.block.TsBlock;
 import org.apache.tsfile.utils.RamUsageEstimator;
 
+import java.util.Map;
+
 public class ExchangeOperator implements SourceOperator {
 
   private static final long INSTANCE_SIZE =
       RamUsageEstimator.shallowSizeOfInstance(ExchangeOperator.class);
 
+  public static final String SIZE_IN_BYTES = "sizeInBytes";
+

Review Comment:
   add `operatorContext.getSpecifiedInfo().put(SIZE_IN_BYTES, 
receivedSizeInBytes);` in each constructor.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/ExchangeOperator.java:
##########
@@ -79,7 +83,17 @@ public OperatorContext getOperatorContext() {
 
   @Override
   public TsBlock next() throws Exception {
-    return sourceHandle.receive();
+    TsBlock receiveBlock = sourceHandle.receive();
+    if (receiveBlock != null) {
+      Map<String, String> specifiedInfo = operatorContext.getSpecifiedInfo();
+      specifiedInfo.compute(
+          SIZE_IN_BYTES,
+          (key, oldValue) ->
+              String.valueOf(
+                  receiveBlock.getSizeInBytes()
+                      + Long.parseLong(oldValue == null ? "0" : oldValue)));

Review Comment:
   ```suggestion
         receivedSizeInBytes.addAndGet(receiveBlock.getRetainedSizeInBytes());
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java:
##########
@@ -128,13 +134,19 @@ public TsBlock getAllSatisfiedData() {
 
   private static final Logger LOGGER = 
LoggerFactory.getLogger(MemAlignedPageReader.class);
 
-  private boolean[] buildSatisfyInfoArray() {
+  private boolean[] buildSatisfyInfoArray(Consumer<Long> filterRowsRecorder) {

Review Comment:
   ```suggestion
     private boolean[] buildSatisfyInfoArray(LongConsumer filterRowsRecorder) {
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java:
##########
@@ -886,6 +908,25 @@ public TsBlock nextPage() throws IOException {
     }
   }
 
+  private TsBlock filterAndPaginateCachedBlock(TsBlock tsBlock) {
+    if (scanOptions.getPushDownFilter() == null) {
+      return paginationController.applyTsBlock(tsBlock);
+    }
+    if (this.context.isVerbose()) {
+      return TsBlockUtil.applyFilterAndLimitOffsetToTsBlock(
+          tsBlock,
+          new TsBlockBuilder(getTsDataTypeList()),
+          scanOptions.getPushDownFilter(),
+          paginationController,
+          s -> this.context.getQueryStatistics().addFilteredRowsOfRowLevel(s));

Review Comment:
   ```suggestion
             this.context.getQueryStatistics()::addFilteredRowsOfRowLevel);
   ```



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