Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VL][1.2] Port #6573 #7025 #7132 #7973

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cpp/velox/compute/WholeStageResultIterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,22 @@ void WholeStageResultIterator::collectMetrics() {
return;
}

if (veloxCfg_->get<bool>(kDebugModeEnabled, false)) {
auto planWithStats = velox::exec::printPlanWithStats(*veloxPlan_.get(), task_->taskStats(), true);
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(), 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
3 changes: 3 additions & 0 deletions cpp/velox/config/VeloxConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const std::string kBloomFilterNumBits = "spark.gluten.sql.columnar.backend.velox
const std::string kBloomFilterMaxNumBits = "spark.gluten.sql.columnar.backend.velox.bloomFilter.maxNumBits";
const std::string kVeloxSplitPreloadPerDriver = "spark.gluten.sql.columnar.backend.velox.SplitPreloadPerDriver";

const std::string kShowTaskMetricsWhenFinished = "spark.gluten.sql.columnar.backend.velox.showTaskMetricsWhenFinished";
const bool kShowTaskMetricsWhenFinishedDefault = false;

const std::string kEnableUserExceptionStacktrace =
"spark.gluten.sql.columnar.backend.velox.enableUserExceptionStacktrace";
const bool kEnableUserExceptionStacktraceDefault = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ object GlutenImplicits {
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "false") {
// AQE is not materialized, so the columnar rules are not applied.
// For this case, We apply columnar rules manually with disable AQE.
val qe = spark.sessionState.executePlan(logicalPlan)
val qe = spark.sessionState.executePlan(logicalPlan, CommandExecutionMode.SKIP)
processPlan(qe.executedPlan, concat.append, collectFallbackFunc)
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,13 @@ object GlutenConfig {
.booleanConf
.createWithDefault(true)

val COLUMNAR_VELOX_SHOW_TASK_METRICS_WHEN_FINISHED =
buildConf("spark.gluten.sql.columnar.backend.velox.showTaskMetricsWhenFinished")
.internal()
.doc("Show velox full task metrics when finished.")
.booleanConf
.createWithDefault(false)

val COLUMNAR_VELOX_MEMORY_USE_HUGE_PAGES =
buildConf("spark.gluten.sql.columnar.backend.velox.memoryUseHugePages")
.internal()
Expand Down
Loading