Skip to content

Commit 6ab9428

Browse files
committed
[SPARK-55880][UI] Link SQL plan metric stage IDs to stage detail page
### What changes were proposed in this pull request? Make stage IDs in the SQL plan visualization metric detail panel clickable links to the corresponding stage detail page. When the "Show Stage ID and Task ID" checkbox is enabled on the SQL execution page, each metric row in the side panel shows a Stage column. Previously this was plain text like `3.0`. Now it renders as a hyperlink to `/stages/stage/?id=3&attempt=0`. ### Why are the changes needed? Navigating from a SQL plan node metric to the corresponding stage requires manually copying the stage ID and navigating to the Stages tab. A direct link improves workflow efficiency. ### Does this PR introduce _any_ user-facing change? Yes — Stage IDs in the SQL plan metric detail panel are now clickable links. ### How was this patch tested? Manual testing. The change is JS-only (no Scala changes). ### Was this patch authored or co-authored using generative AI tooling? Yes, co-authored with GitHub Copilot. Closes #54785 from yaooqinn/SPARK-55880. Authored-by: Kent Yao <[email protected]> Signed-off-by: Kent Yao <[email protected]>
1 parent 81f2172 commit 6ab9428

File tree

1 file changed

+11
-2
lines changed
  • sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static

1 file changed

+11
-2
lines changed

sql/core/src/main/resources/org/apache/spark/sql/execution/ui/static/spark-sql-viz.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
/* global $, d3, dagreD3, graphlibDot */
18+
/* global $, d3, dagreD3, graphlibDot, uiRoot, appBasePath */
1919

2020
var PlanVizConstants = {
2121
svgMarginX: 16,
@@ -385,12 +385,21 @@ function buildStatTable(total, min, med, maxVal,
385385
h += "<td>" + min + "</td><td>" + med +
386386
"</td><td>" + maxVal + "</td>";
387387
if (showStageTask) {
388-
h += "<td>" + stageId + "</td><td>" + taskId + "</td>";
388+
h += "<td>" + stageLink(stageId) + "</td><td>" + taskId + "</td>";
389389
}
390390
h += "</tr></tbody></table>";
391391
return h;
392392
}
393393

394+
function stageLink(stageId) {
395+
if (!stageId) return "";
396+
var parts = stageId.split(".");
397+
var id = parts[0];
398+
var attempt = parts.length > 1 ? parts[1] : "0";
399+
var url = uiRoot + appBasePath + "/stages/stage/?id=" + id + "&attempt=" + attempt;
400+
return '<a href="' + url + '">' + stageId + '</a>';
401+
}
402+
394403
/*
395404
* Update the detail side panel with the selected node's information.
396405
*/

0 commit comments

Comments
 (0)