Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kecookier committed Aug 27, 2024
1 parent eff5de6 commit 15018c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions cpp/velox/compute/WholeStageResultIterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,22 @@ void WholeStageResultIterator::collectMetrics() {
return;
}

const auto& taskStats = task_->taskStats();
if (taskStats.executionStartTimeMs == 0) {
LOG(INFO) << "collectMetrics failed, taskStats is zero, maybe task never 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++) {
Expand Down
4 changes: 3 additions & 1 deletion cpp/velox/compute/WholeStageResultIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 15018c8

Please sign in to comment.