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

zhaokuo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 79bb99a88 [GLUTEN-7024][VL] Skip call collectMetrics when the task 
does not call next() (#7025)
79bb99a88 is described below

commit 79bb99a8862983d5d26f2f591d9785b24b79eeb0
Author: zhaokuo <[email protected]>
AuthorDate: Thu Aug 29 13:19:16 2024 +0800

    [GLUTEN-7024][VL] Skip call collectMetrics when the task does not call 
next() (#7025)
---
 cpp/velox/compute/WholeStageResultIterator.cc | 10 ++++++++--
 cpp/velox/compute/WholeStageResultIterator.h  |  4 +++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/cpp/velox/compute/WholeStageResultIterator.cc 
b/cpp/velox/compute/WholeStageResultIterator.cc
index 7ad8cb275..c306564dc 100644
--- a/cpp/velox/compute/WholeStageResultIterator.cc
+++ b/cpp/velox/compute/WholeStageResultIterator.cc
@@ -302,16 +302,22 @@ void WholeStageResultIterator::collectMetrics() {
     return;
   }
 
+  const auto& taskStats = task_->taskStats();
+  if (taskStats.executionStartTimeMs == 0) {
+    LOG(INFO) << "Skip collect task metrics since task did not call next().";
+    return;
+  }
+
   if (veloxCfg_->get<bool>(kDebugModeEnabled, false) ||
       veloxCfg_->get<bool>(kShowTaskMetricsWhenFinished, 
kShowTaskMetricsWhenFinishedDefault)) {
-    auto planWithStats = velox::exec::printPlanWithStats(*veloxPlan_.get(), 
task_->taskStats(), true);
+    auto planWithStats = velox::exec::printPlanWithStats(*veloxPlan_.get(), 
taskStats, true);
     std::ostringstream oss;
     oss << "Native Plan with stats for: " << taskInfo_;
     oss << "\n" << planWithStats << std::endl;
     LOG(INFO) << oss.str();
   }
 
-  auto planStats = velox::exec::toPlanStats(task_->taskStats());
+  auto planStats = velox::exec::toPlanStats(taskStats);
   // Calculate the total number of metrics.
   int statsNum = 0;
   for (int idx = 0; idx < orderedNodeIds_.size(); idx++) {
diff --git a/cpp/velox/compute/WholeStageResultIterator.h 
b/cpp/velox/compute/WholeStageResultIterator.h
index 371ec0c14..50ec1201e 100644
--- a/cpp/velox/compute/WholeStageResultIterator.h
+++ b/cpp/velox/compute/WholeStageResultIterator.h
@@ -55,7 +55,9 @@ class WholeStageResultIterator : public ColumnarBatchIterator 
{
 
   Metrics* getMetrics(int64_t exportNanos) {
     collectMetrics();
-    metrics_->veloxToArrow = exportNanos;
+    if (metrics_) {
+      metrics_->veloxToArrow = exportNanos;
+    }
     return metrics_.get();
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to