Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import java.util.concurrent.atomic.AtomicLong

import scala.collection.mutable

import org.apache.commons.lang3.StringEscapeUtils

import org.apache.spark.sql.execution.SparkPlanInfo
import org.apache.spark.sql.execution.metric.SQLMetrics

Expand Down Expand Up @@ -136,16 +138,14 @@ private[ui] class SparkPlanGraphNode(
}

if (values.nonEmpty) {
// If there are metrics, display each entry in a separate line. We should use an escaped
// "\n" here to follow the dot syntax.
//
// If there are metrics, display each entry in a separate line.
// Note: whitespace between two "\n"s is to create an empty line between the name of
// SparkPlan and metrics. If removing it, it won't display the empty line in UI.
builder ++= "\\n \\n"
builder ++= values.mkString("\\n")
builder ++= "\n \n"
builder ++= values.mkString("\n")
}

s""" $id [label="${builder.toString()}"];"""
s""" $id [label="${StringEscapeUtils.escapeJava(builder.toString())}"];"""
}
}

Expand All @@ -162,7 +162,7 @@ private[ui] class SparkPlanGraphCluster(
override def makeDotNode(metricsValue: Map[Long, String]): String = {
s"""
| subgraph cluster${id} {
| label=${name};
| label="${StringEscapeUtils.escapeJava(name)}";
| ${nodes.map(_.makeDotNode(metricsValue)).mkString(" \n")}
| }
""".stripMargin
Expand Down