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 b1275a0190ac [SPARK-51648][UI] Move inlined javascript in 
ExecutionPage to spark-sql-viz.js
b1275a0190ac is described below

commit b1275a0190ac551937ae4fb90a289eccc160f394
Author: Kent Yao <[email protected]>
AuthorDate: Mon Mar 31 07:55:03 2025 +0900

    [SPARK-51648][UI] Move inlined javascript in ExecutionPage to 
spark-sql-viz.js
    
    ### What changes were proposed in this pull request?
    This PR moves the inlined javascript in ExecutionPage to spark-sql-viz.js
    
    ### Why are the changes needed?
    
    - Improve the debugbility of Spark UI
    - Simply the development progress as the js code can be updated to the jar 
archive w/o compiling the full maven module.
    
    ### Does this PR introduce _any_ user-facing change?
    no
    
    ### How was this patch tested?
    
    Locally verified the ExecutionPage
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #50440 from yaooqinn/SPARK-51648.
    
    Authored-by: Kent Yao <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../spark/sql/execution/ui/static/spark-sql-viz.js      | 17 +++++++++++++----
 .../apache/spark/sql/execution/ui/ExecutionPage.scala   |  7 -------
 2 files changed, 13 insertions(+), 11 deletions(-)

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 37bae5e4b774..faf30d5d5422 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
@@ -22,13 +22,10 @@ var PlanVizConstants = {
   svgMarginY: 16
 };
 
-/* eslint-disable no-unused-vars */
 function shouldRenderPlanViz() {
   return planVizContainer().selectAll("svg").empty();
 }
-/* eslint-enable no-unused-vars */
 
-/* eslint-disable no-unused-vars */
 function renderPlanViz() {
   var svg = planVizContainer().append("svg");
   var metadata = d3.select("#plan-viz-metadata");
@@ -52,7 +49,6 @@ function renderPlanViz() {
   resizeSvg(svg);
   postprocessForAdditionalMetrics();
 }
-/* eslint-enable no-unused-vars */
 
 /* -------------------- *
  * | Helper functions | *
@@ -345,3 +341,16 @@ 
document.getElementById("plan-viz-download-btn").addEventListener("click", async
   }
   downloadPlanBlob(blob, format);
 });
+
+/* eslint-disable no-unused-vars */
+function clickPhysicalPlanDetails() {
+/* eslint-enable no-unused-vars */
+  $('#physical-plan-details').toggle();
+  
$('#physical-plan-details-arrow').toggleClass('arrow-open').toggleClass('arrow-closed');
+}
+
+document.addEventListener("DOMContentLoaded", function () {
+  if (shouldRenderPlanViz()) {
+    renderPlanViz();
+  }
+});
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala
index e705b5cf46ed..f11d3f6eb343 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/ui/ExecutionPage.scala
@@ -144,7 +144,6 @@ class ExecutionPage(parent: SQLTab) extends 
WebUIPage("execution") with Logging
         </div>
       </div>
       {planVisualizationResources(request)}
-      <script>$(function() {{ if (shouldRenderPlanViz()) {{ renderPlanViz(); 
}} }})</script>
     </div>
   }
 
@@ -163,12 +162,6 @@ class ExecutionPage(parent: SQLTab) extends 
WebUIPage("execution") with Logging
     <div id="physical-plan-details" style="display: none;">
       <pre>{physicalPlanDescription}</pre>
     </div>
-    <script>
-      function clickPhysicalPlanDetails() {{
-        $('#physical-plan-details').toggle();
-        
$('#physical-plan-details-arrow').toggleClass('arrow-open').toggleClass('arrow-closed');
-      }}
-    </script>
   }
 
   private def modifiedConfigs(modifiedConfigs: Map[String, String]): Seq[Node] 
= {


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

Reply via email to