diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2016-02-22 17:42:30 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2016-02-22 17:42:30 -0800 |
commit | a11b3995190cb4a983adcc8667f7b316cce18d24 (patch) | |
tree | b3af900d51e644103286b6b4d1b6504806ab731b /core | |
parent | 33ef3aa7eabbe323620eb77fa94a53996ed0251d (diff) | |
download | spark-a11b3995190cb4a983adcc8667f7b316cce18d24.tar.gz spark-a11b3995190cb4a983adcc8667f7b316cce18d24.tar.bz2 spark-a11b3995190cb4a983adcc8667f7b316cce18d24.zip |
[SPARK-13298][CORE][UI] Escape "label" to avoid DAG being broken by some special character
## What changes were proposed in this pull request?
When there are some special characters (e.g., `"`, `\`) in `label`, DAG will be broken. This patch just escapes `label` to avoid DAG being broken by some special characters
## How was the this patch tested?
Jenkins tests
Author: Shixiong Zhu <shixiong@databricks.com>
Closes #11309 from zsxwing/SPARK-13298.
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala b/core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala index 003c218aad..cb28271998 100644 --- a/core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala +++ b/core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala @@ -20,10 +20,11 @@ package org.apache.spark.ui.scope import scala.collection.mutable import scala.collection.mutable.{ListBuffer, StringBuilder} +import org.apache.commons.lang3.StringEscapeUtils + import org.apache.spark.Logging import org.apache.spark.scheduler.StageInfo import org.apache.spark.storage.StorageLevel -import org.apache.spark.util.CallSite /** * A representation of a generic cluster graph used for storing information on RDD operations. @@ -183,7 +184,7 @@ private[ui] object RDDOperationGraph extends Logging { /** Return the dot representation of a node in an RDDOperationGraph. */ private def makeDotNode(node: RDDOperationNode): String = { val label = s"${node.name} [${node.id}]\n${node.callsite}" - s"""${node.id} [label="$label"]""" + s"""${node.id} [label="${StringEscapeUtils.escapeJava(label)}"]""" } /** Update the dot representation of the RDDOperationGraph in cluster to subgraph. */ @@ -192,7 +193,7 @@ private[ui] object RDDOperationGraph extends Logging { cluster: RDDOperationCluster, indent: String): Unit = { subgraph.append(indent).append(s"subgraph cluster${cluster.id} {\n") - subgraph.append(indent).append(s""" label="${cluster.name}";\n""") + .append(indent).append(s""" label="${StringEscapeUtils.escapeJava(cluster.name)}";\n""") cluster.childNodes.foreach { node => subgraph.append(indent).append(s" ${makeDotNode(node)};\n") } |