diff options
-rw-r--r-- | sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SparkPlanGraph.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SparkPlanGraph.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SparkPlanGraph.scala index 12e586ada5..83372aa2e9 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SparkPlanGraph.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SparkPlanGraph.scala @@ -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 @@ -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())}"];""" } } @@ -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 |