Skip to content

Commit

Permalink
Review comments are addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
Eren Avsarogullari committed May 2, 2020
1 parent 6c5c2f9 commit 817ebab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ private[v1] class SqlResource extends BaseAppResource {
metricDetails.sortBy(_.nodeId).reverse
}

private def prepareExecutionData(exec: SQLExecutionUIData,
nodeIdAndWSCGIdMap: Map[Long, Option[Long]] = Map.empty,
details: Boolean,
planDescription: Boolean): ExecutionData = {
private def prepareExecutionData(
exec: SQLExecutionUIData,
nodeIdAndWSCGIdMap: Map[Long, Option[Long]] = Map.empty,
details: Boolean,
planDescription: Boolean): ExecutionData = {

var running = Seq[Int]()
var completed = Seq[Int]()
var failed = Seq[Int]()
Expand All @@ -121,8 +123,12 @@ private[v1] class SqlResource extends BaseAppResource {
val duration = exec.completionTime.getOrElse(new Date()).getTime - exec.submissionTime
val planDetails = if (details && planDescription) exec.physicalPlanDescription else ""
val metrics =
if (details) printableMetrics(exec.metrics, exec.metricValues, nodeIdAndWSCGIdMap)
else Seq.empty
if (details) {
printableMetrics(exec.metrics, exec.metricValues, nodeIdAndWSCGIdMap)
} else {
Seq.empty
}

new ExecutionData(
exec.executionId,
status,
Expand All @@ -138,10 +144,11 @@ private[v1] class SqlResource extends BaseAppResource {

private def getNodeIdAndWSCGIdMap(graph: SparkPlanGraph): Map[Long, Option[Long]] = {
val wscgNodes = graph.allNodes.filter(_.name.trim.startsWith(WHOLE_STAGE_CODEGEN))
val nodeIdAndWSCGIdMap: Map[Long, Option[Long]] = wscgNodes.flatMap { _ match {
case x: SparkPlanGraphCluster => x.nodes.map(_.id -> getWholeStageCodegenId(x.name.trim))
case _ => Seq.empty
}
val nodeIdAndWSCGIdMap: Map[Long, Option[Long]] = wscgNodes.flatMap {
_ match {
case x: SparkPlanGraphCluster => x.nodes.map(_.id -> getWholeStageCodegenId(x.name.trim))
case _ => Seq.empty
}
}.toMap

nodeIdAndWSCGIdMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ class ExecutionData private[spark] (
val failedJobIds: Seq[Int],
val metricDetails: Seq[MetricDetails])

case class MetricDetails private[spark] (nodeId: Long,
nodeName: String,
wholeStageCodegenId: Option[Long] = None,
metrics: Seq[Metric])
case class MetricDetails private[spark] (
nodeId: Long,
nodeName: String,
wholeStageCodegenId: Option[Long] = None,
metrics: Seq[Metric])

case class Metric private[spark] (name: String, value: String)

0 comments on commit 817ebab

Please sign in to comment.