marin-ma commented on code in PR #10119:
URL: 
https://github.com/apache/incubator-gluten/pull/10119#discussion_r2201235120


##########
cpp/velox/compute/WholeStageResultIterator.cc:
##########
@@ -374,6 +365,23 @@ void WholeStageResultIterator::collectMetrics() {
 
   metrics_ = std::make_unique<Metrics>(statsNum);
 
+  const int64_t collectTaskStatsThreshold =
+      veloxCfg_->get<int64_t>(kTaskMetricsToEventLogThreshold, 
kTaskMetricsToEventLogThresholdDefault);
+  // Save and print the plan with stats if debug mode is enabled or 
showTaskMetricsWhenFinished is true.
+  if (collectTaskStatsThreshold >= 0 || 
veloxCfg_->get<bool>(kDebugModeEnabled, false) ||
+      veloxCfg_->get<bool>(kShowTaskMetricsWhenFinished, 
kShowTaskMetricsWhenFinishedDefault)) {
+    auto planWithStats = velox::exec::printPlanWithStats(*veloxPlan_.get(), 
taskStats, true);
+    std::ostringstream oss;
+    oss << "Native Plan with stats for: " << taskInfo_;
+    oss << "\n" << planWithStats << std::endl;
+    const auto& stats = oss.str();
+    if (static_cast<int64_t>(taskStats.terminationTimeMs - 
taskStats.executionStartTimeMs) >

Review Comment:
   This is the original logic. The task stats will be printed if 
spark.gluten.sql.debug=true



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


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

Reply via email to