You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ge...@apache.org on 2020/02/09 22:22:21 UTC
[spark] branch branch-3.0 updated: [SPARK-30684 ][WEBUI][FollowUp]
A new approach for SPARK-30684
This is an automated email from the ASF dual-hosted git repository.
gengliang pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 00c761d [SPARK-30684 ][WEBUI][FollowUp] A new approach for SPARK-30684
00c761d is described below
commit 00c761d15e2628c8c5e1a9dad5ae122f292eae28
Author: Gengliang Wang <ge...@databricks.com>
AuthorDate: Sun Feb 9 14:18:51 2020 -0800
[SPARK-30684 ][WEBUI][FollowUp] A new approach for SPARK-30684
### What changes were proposed in this pull request?
Simplify the changes for adding metrics description for WholeStageCodegen in https://github.com/apache/spark/pull/27405
### Why are the changes needed?
In https://github.com/apache/spark/pull/27405, the UI changes can be made without using the function `adjustPositionOfOperationName` to adjust the position of operation name and mark as an operation-name class.
I suggest we make simpler changes so that it would be easier for future development.
### Does this PR introduce any user-facing change?
No
### How was this patch tested?
Manual test with the queries provided in https://github.com/apache/spark/pull/27405
```
sc.parallelize(1 to 10).toDF.sort("value").filter("value > 1").selectExpr("value * 2").show
sc.parallelize(1 to 10).toDF.sort("value").filter("value > 1").selectExpr("value * 2").write.format("json").mode("overwrite").save("/tmp/test_output")
sc.parallelize(1 to 10).toDF.write.format("json").mode("append").save("/tmp/test_output")
```
![image](https://user-images.githubusercontent.com/1097932/74073629-e3f09f00-49bf-11ea-90dc-1edb5ca29e5e.png)
Closes #27490 from gengliangwang/wholeCodegenUI.
Authored-by: Gengliang Wang <ge...@databricks.com>
Signed-off-by: Gengliang Wang <ge...@databricks.com>
(cherry picked from commit b877aac14657832d1b896ea57e06b0d0fd15ee01)
Signed-off-by: Gengliang Wang <ge...@databricks.com>
---
.../sql/execution/ui/static/spark-sql-viz.css | 8 ++----
.../spark/sql/execution/ui/static/spark-sql-viz.js | 31 +---------------------
.../spark/sql/execution/ui/SparkPlanGraph.scala | 18 ++++++-------
3 files changed, 11 insertions(+), 46 deletions(-)
diff --git a/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.css b/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.css
index eff0142..2018838 100644
--- a/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.css
+++ b/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.css
@@ -18,6 +18,7 @@
#plan-viz-graph .label {
font-weight: normal;
text-shadow: none;
+ color: black;
}
#plan-viz-graph svg g.cluster rect {
@@ -32,13 +33,8 @@
stroke-width: 1px;
}
-/* This declaration is needed to define the width of rectangles */
-#plan-viz-graph svg text :first-child {
- font-weight: bold;
-}
-
/* Highlight the SparkPlan node name */
-#plan-viz-graph svg text .operator-name {
+#plan-viz-graph svg text :first-child {
font-weight: bold;
}
diff --git a/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.js b/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.js
index e6ce641..c834914 100644
--- a/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.js
+++ b/sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.js
@@ -34,7 +34,6 @@ function renderPlanViz() {
preprocessGraphLayout(g);
var renderer = new dagreD3.render();
renderer(graph, g);
- adjustPositionOfOperationName();
// Round corners on rectangles
svg
@@ -82,7 +81,7 @@ function setupTooltipForSparkPlanNode(nodeId) {
* and sizes of graph elements, e.g. padding, font style, shape.
*/
function preprocessGraphLayout(g) {
- g.graph().ranksep = "90";
+ g.graph().ranksep = "70";
var nodes = g.nodes();
for (var i = 0; i < nodes.length; i++) {
var node = g.node(nodes[i]);
@@ -129,34 +128,6 @@ function resizeSvg(svg) {
.attr("height", height);
}
-
-/* Helper function to adjust the position of operation name and mark as a operation-name class. */
-function adjustPositionOfOperationName() {
- $("#plan-viz-graph svg text")
- .each(function() {
- var tspans = $(this).find("tspan");
-
- if (tspans[0].textContent.trim() !== "") {
- var isOperationNameOnly =
- $(tspans).filter(function(i, n) {
- return i !== 0 && n.textContent.trim() !== "";
- }).length === 0;
-
- if (isOperationNameOnly) {
- // If the only text in a node is operation name,
- // vertically centering the position of operation name.
- var operationName = tspans[0].textContent;
- var half = parseInt(tspans.length / 2);
- tspans[0].textContent = tspans[half].textContent;
- tspans[half].textContent = operationName;
- $(tspans[half]).addClass("operator-name");
- } else {
- tspans.first().addClass("operator-name");
- }
- }
- });
-}
-
/* Helper function to convert attributes to numeric values. */
function toFloat(f) {
if (f) {
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 1e767c3..d31d778 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
@@ -169,20 +169,18 @@ private[ui] class SparkPlanGraphNode(
metric.name + ": " + value
}
- // 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"
-
if (values.nonEmpty) {
+ // 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")
+ s""" $id [label="${StringEscapeUtils.escapeJava(builder.toString())}"];"""
} else {
- // A certain level of height is needed for a rect as a node in a sub-graph
- // to avoid layout collapse for sub-graphs.
- builder ++= " "
+ // SPARK-30684: when there is no metrics, add empty lines to increase the height of the node,
+ // so that there won't be gaps between an edge and a small node.
+ s""" $id [labelType="html" label="<br><b>$name</b><br><br>"];"""
}
-
- s""" $id [label="${StringEscapeUtils.escapeJava(builder.toString())}"];"""
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org