This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 361ee9c46594 [SPARK-54374][SQL][UI][FOLLOWUP] Fix SQL plan 
visualization display issue caused by initial viewBox
361ee9c46594 is described below

commit 361ee9c465942b10f57ac35f1483e3f516c2c1b7
Author: Kent Yao <[email protected]>
AuthorDate: Wed Feb 25 11:11:16 2026 -0800

    [SPARK-54374][SQL][UI][FOLLOWUP] Fix SQL plan visualization display issue 
caused by initial viewBox
    
    ### What changes were proposed in this pull request?
    
    This is a follow-up fix for #53864. Replace the initial `viewBox` attribute 
with `width` and `height` on the SQL plan SVG element.
    
    ### Why are the changes needed?
    
    Setting `viewBox` before dagre-d3 renders the graph changes the SVG 
coordinate system, which affects how dagre-d3 positions elements. This causes 
display issues as reported by pan3793 in 
https://github.com/apache/spark/pull/53864#issuecomment-3889339344.
    
    Using `width` and `height` instead gives a large initial canvas (preventing 
the tiny default render — the original intent of #53864) without altering the 
coordinate system that dagre-d3 depends on. The `resizeSvg()` function still 
correctly sets the final `viewBox`, `width`, and `height` after rendering 
completes.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, fixes the SQL plan visualization display regression introduced by 
#53864.
    
    ### How was this patch tested?
    
    Tested in Chrome DevTools.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Yes, GitHub Copilot was used.
    
    Closes #54482 from yaooqinn/SPARK-54374.
    
    Authored-by: Kent Yao <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../org/apache/spark/sql/execution/ui/static/spark-sql-viz.js          | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 0065f81a6a36..2b13c93ad4f3 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
@@ -29,7 +29,8 @@ function shouldRenderPlanViz() {
 function renderPlanViz() {
   var svg = planVizContainer()
     .append("svg")
-    .attr("viewBox", `${-PlanVizConstants.svgMarginX} 
${-PlanVizConstants.svgMarginY} ${window.innerWidth || 1920} 1000`);
+    .attr("width", window.innerWidth || 1920)
+    .attr("height", 1000);
   var metadata = d3.select("#plan-viz-metadata");
   var dot = metadata.select(".dot-file").text().trim();
   var graph = svg.append("g");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to