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

jackietien pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 9f3972fc3b1 [to dev/1.3] Add metric for aggregator
9f3972fc3b1 is described below

commit 9f3972fc3b12bc9a8f3cb09239147890c76339c3
Author: shuwenwei <[email protected]>
AuthorDate: Wed Jun 18 15:31:13 2025 +0800

    [to dev/1.3] Add metric for aggregator
---
 .../execution/aggregation/Aggregator.java          | 37 +++++++++++++---------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/Aggregator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/Aggregator.java
index fb4fd904036..6992d80b53f 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/Aggregator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/aggregation/Aggregator.java
@@ -64,22 +64,29 @@ public class Aggregator {
 
   // Used for SeriesAggregateScanOperator and RawDataAggregateOperator
   public void processTsBlock(TsBlock tsBlock, BitMap bitMap) {
-    checkArgument(
-        step.isInputRaw(),
-        "Step in SeriesAggregateScanOperator and RawDataAggregateOperator can 
only process raw input");
-    for (InputLocation[] inputLocations : inputLocationList) {
-      Column[] timeAndValueColumn = new Column[1 + inputLocations.length];
-      timeAndValueColumn[0] = tsBlock.getTimeColumn();
-      for (int i = 0; i < inputLocations.length; i++) {
-        checkArgument(
-            inputLocations[i].getTsBlockIndex() == 0,
-            "RawDataAggregateOperator can only process one tsBlock input.");
-        int index = inputLocations[i].getValueColumnIndex();
-        // for count_time, time column is also its value column
-        // for max_by, the input column can also be time column.
-        timeAndValueColumn[1 + i] = index == -1 ? timeAndValueColumn[0] : 
tsBlock.getColumn(index);
+    long startTime = System.nanoTime();
+    try {
+      checkArgument(
+          step.isInputRaw(),
+          "Step in SeriesAggregateScanOperator and RawDataAggregateOperator 
can only process raw input");
+      for (InputLocation[] inputLocations : inputLocationList) {
+        Column[] timeAndValueColumn = new Column[1 + inputLocations.length];
+        timeAndValueColumn[0] = tsBlock.getTimeColumn();
+        for (int i = 0; i < inputLocations.length; i++) {
+          checkArgument(
+              inputLocations[i].getTsBlockIndex() == 0,
+              "RawDataAggregateOperator can only process one tsBlock input.");
+          int index = inputLocations[i].getValueColumnIndex();
+          // for count_time, time column is also its value column
+          // for max_by, the input column can also be time column.
+          timeAndValueColumn[1 + i] =
+              index == -1 ? timeAndValueColumn[0] : tsBlock.getColumn(index);
+        }
+        accumulator.addInput(timeAndValueColumn, bitMap);
       }
-      accumulator.addInput(timeAndValueColumn, bitMap);
+    } finally {
+      QUERY_EXECUTION_METRICS.recordExecutionCost(
+          AGGREGATION_FROM_RAW_DATA, System.nanoTime() - startTime);
     }
   }
 

Reply via email to