Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-13298][Core][UI]Escape "label" to avoid DAG being broken by some special character #11309

Closed
wants to merge 2 commits into from
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 @@ -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.
Expand Down Expand Up @@ -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. */
Expand All @@ -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")
}
Expand Down