[SPARK-30531][WEB UI] Do not render plan viz when it exists already
### What changes were proposed in this pull request? When you save a Spark UI SQL query page to disk and then display the html file with your browser, the query plan will be rendered a second time. This change avoids rendering the plan visualization when it exists already. This is master: ![grafik](https://user-images.githubusercontent.com/44700269/72543429-fcb8d980-3885-11ea-82aa-c0b3638847e5.png) And with the fix: ![grafik](https://user-images.githubusercontent.com/44700269/72543641-57523580-3886-11ea-8cdf-5fb0cdffa983.png) ### Why are the changes needed? The duplicate query plan is unexpected and redundant. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Manually tested. Testing this in a reproducible way requires a running browser or HTML rendering engine that executes the JavaScript. Closes #27238 from EnricoMi/branch-sql-ui-duplicate-plan. Authored-by: Enrico Minack <github@enrico.minack.dev> Signed-off-by: Sean Owen <srowen@gmail.com>
This commit is contained in:
parent
38f4e599b3
commit
eccae13a5f
|
@ -20,6 +20,10 @@ var PlanVizConstants = {
|
|||
svgMarginY: 16
|
||||
};
|
||||
|
||||
function shouldRenderPlanViz() {
|
||||
return planVizContainer().selectAll("svg").empty();
|
||||
}
|
||||
|
||||
function renderPlanViz() {
|
||||
var svg = planVizContainer().append("svg");
|
||||
var metadata = d3.select("#plan-viz-metadata");
|
||||
|
|
|
@ -116,7 +116,7 @@ class ExecutionPage(parent: SQLTab) extends WebUIPage("execution") with Logging
|
|||
{metadata}
|
||||
</div>
|
||||
{planVisualizationResources(request)}
|
||||
<script>$(function() {{ renderPlanViz(); }})</script>
|
||||
<script>$(function() {{ if (shouldRenderPlanViz()) {{ renderPlanViz(); }} }})</script>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue