You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ro...@apache.org on 2023/03/23 14:40:03 UTC

[pinot] branch master updated: Bug fix: Start counting operator execution time from first NoOp block (#10450)

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

rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new f3c2c0d98f Bug fix: Start counting operator execution time from first NoOp block (#10450)
f3c2c0d98f is described below

commit f3c2c0d98f4639d4023e159b29e424863c1c4496
Author: Kartik Khare <kh...@gmail.com>
AuthorDate: Thu Mar 23 20:09:53 2023 +0530

    Bug fix: Start counting operator execution time from first NoOp block (#10450)
    
    * Bug fix: Start counting operator execution time from first NoOp block
    
    * Move the reset logic to endTimer
    
    * Remove unused methods
    
    ---------
    
    Co-authored-by: Kartik Khare <kh...@Kartiks-MacBook-Pro.local>
---
 .../pinot/query/runtime/operator/MultiStageOperator.java       |  3 ++-
 .../org/apache/pinot/query/runtime/operator/OperatorStats.java | 10 +++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/MultiStageOperator.java b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/MultiStageOperator.java
index 8f97f57d46..160b3d0f58 100644
--- a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/MultiStageOperator.java
+++ b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/MultiStageOperator.java
@@ -64,8 +64,9 @@ public abstract class MultiStageOperator implements Operator<TransferableBlock>,
     try (InvocationScope ignored = Tracing.getTracer().createScope(getClass())) {
       _operatorStats.startTimer();
       TransferableBlock nextBlock = getNextBlock();
+      _operatorStats.endTimer(nextBlock);
+
       _operatorStats.recordRow(1, nextBlock.getNumRows());
-      _operatorStats.endTimer();
       if (nextBlock.isEndOfStreamBlock()) {
         if (nextBlock.isSuccessfulEndOfStreamBlock()) {
           for (MultiStageOperator op : getChildOperators()) {
diff --git a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/OperatorStats.java b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/OperatorStats.java
index cb01623ee4..52ca89a3ee 100644
--- a/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/OperatorStats.java
+++ b/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/OperatorStats.java
@@ -24,6 +24,7 @@ import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import org.apache.pinot.common.datatable.DataTable;
 import org.apache.pinot.query.routing.VirtualServerAddress;
+import org.apache.pinot.query.runtime.blocks.TransferableBlock;
 import org.apache.pinot.query.runtime.operator.utils.OperatorUtils;
 import org.apache.pinot.query.runtime.plan.OpChainExecutionContext;
 
@@ -42,6 +43,7 @@ public class OperatorStats {
   private int _numRows = 0;
   private long _startTimeMs = -1;
   private final Map<String, String> _executionStats;
+  private boolean _processingStarted = false;
 
   public OperatorStats(OpChainExecutionContext context, String operatorType) {
     this(context.getRequestId(), context.getStageId(), context.getServer(), operatorType);
@@ -63,10 +65,16 @@ public class OperatorStats {
     }
   }
 
-  public void endTimer() {
+  public void endTimer(TransferableBlock block) {
     if (_executeStopwatch.isRunning()) {
       _executeStopwatch.stop();
     }
+    if (!_processingStarted && block.isNoOpBlock()) {
+      _startTimeMs = -1;
+      _executeStopwatch.reset();
+    } else {
+      _processingStarted = true;
+    }
   }
 
   public void recordRow(int numBlock, int numRows) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org