From 9dc883b140ddc4bc38dca287dfb839b610bb5754 Mon Sep 17 00:00:00 2001 From: Alex Behm Date: Fri, 13 Jun 2014 12:07:44 -0700 Subject: [PATCH] IMPALA-1005: Print consistent plan fragment ids in explain plan and runtime profile. Change-Id: I63b59a896dc9dc0c9ed1d5e889f7b5626ba61202 Reviewed-on: http://gerrit.ent.cloudera.com:8080/3037 Reviewed-by: Alex Behm Tested-by: jenkins Reviewed-on: http://gerrit.ent.cloudera.com:8080/3124 --- be/src/runtime/coordinator.cc | 8 +++++--- common/thrift/Planner.thrift | 3 +++ .../java/com/cloudera/impala/planner/PlanFragment.java | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/be/src/runtime/coordinator.cc b/be/src/runtime/coordinator.cc index eef33084c..d5d19bed9 100644 --- a/be/src/runtime/coordinator.cc +++ b/be/src/runtime/coordinator.cc @@ -911,7 +911,9 @@ void Coordinator::InitExecProfile(const TQueryExecRequest& request) { // register coordinator's fragment profile now, before those of the backends, // so it shows up at the top query_profile_->AddChild(executor_->profile()); - executor_->profile()->set_name("Coordinator Fragment"); + stringstream ss; + ss << "Coordinator Fragment " << request.fragments[0].display_name; + executor_->profile()->set_name(ss.str()); CollectScanNodeCounters(executor_->profile(), &coordinator_counters_); } @@ -930,7 +932,7 @@ void Coordinator::InitExecProfile(const TQueryExecRequest& request) { continue; } stringstream ss; - ss << "Averaged Fragment " << i; + ss << "Averaged Fragment " << request.fragments[i].display_name; fragment_profiles_[i].averaged_profile = obj_pool()->Add(new RuntimeProfile(obj_pool(), ss.str(), true)); // Insert the avg profiles in ascending fragment number order. If @@ -944,7 +946,7 @@ void Coordinator::InitExecProfile(const TQueryExecRequest& request) { (i > 0) ? fragment_profiles_[i-1].averaged_profile : NULL); ss.str(""); - ss << "Fragment " << i; + ss << "Fragment " << request.fragments[i].display_name; fragment_profiles_[i].root_profile = obj_pool()->Add(new RuntimeProfile(obj_pool(), ss.str())); // Note: we don't start the wall timer here for the fragment diff --git a/common/thrift/Planner.thrift b/common/thrift/Planner.thrift index 541eabb4a..9581b9d07 100644 --- a/common/thrift/Planner.thrift +++ b/common/thrift/Planner.thrift @@ -28,6 +28,9 @@ include "Partitions.thrift" // plan fragment, including how to produce and how to partition its output. // It leaves out node-specific parameters neede for the actual execution. struct TPlanFragment { + // display name to be shown in the runtime profile; unique within a query + 1: required string display_name + // no plan or descriptor table: query without From clause 2: optional PlanNodes.TPlan plan diff --git a/fe/src/main/java/com/cloudera/impala/planner/PlanFragment.java b/fe/src/main/java/com/cloudera/impala/planner/PlanFragment.java index 47a840557..25972d443 100644 --- a/fe/src/main/java/com/cloudera/impala/planner/PlanFragment.java +++ b/fe/src/main/java/com/cloudera/impala/planner/PlanFragment.java @@ -254,6 +254,7 @@ public class PlanFragment { public TPlanFragment toThrift() { TPlanFragment result = new TPlanFragment(); + result.setDisplay_name(fragmentId_.toString()); if (planRoot_ != null) result.setPlan(planRoot_.treeToThrift()); if (outputExprs_ != null) { result.setOutput_exprs(Expr.treesToThrift(outputExprs_));