Skip to content

[SPARK-56331][UI] Truncate long node labels in SQL plan visualization#55156

Draft
yaooqinn wants to merge 1 commit intoapache:masterfrom
yaooqinn:SPARK-56331
Draft

[SPARK-56331][UI] Truncate long node labels in SQL plan visualization#55156
yaooqinn wants to merge 1 commit intoapache:masterfrom
yaooqinn:SPARK-56331

Conversation

@yaooqinn
Copy link
Copy Markdown
Member

@yaooqinn yaooqinn commented Apr 2, 2026

What changes were proposed in this pull request?

Truncate DOT graph node labels to 36 characters using middle-ellipsis when node names are long (e.g., scan nodes with fully-qualified catalog.schema.table paths from custom catalogs).

The full name remains available in:

  • Tooltip (hover over the node)
  • Side panel (click the node)

Example:

Before: ScanTransformer parquet spark_catalog.longschemaname.catalog_sales  (60+ chars)
After:  ScanTransformer pa…catalog_sales  (36 chars)

Why are the changes needed?

When custom catalogs generate long schema/table identifiers, the plan visualization graph becomes excessively wide and hard to read. Most operator labels are under 30 characters; only scan nodes with fully-qualified paths exceed 36 characters.

Does this PR introduce any user-facing change?

Yes. Long node labels in the SQL plan visualization are now truncated with a middle ellipsis. The full name is still accessible via tooltip and side panel.

How was this patch tested?

  • Updated existing test for truncated label in DOT output
  • Added 4 new tests:
    • Short labels unchanged (Sort, Filter, HashAggregate, null, empty)
    • Long labels truncated with middle ellipsis (boundary, realistic scan names)
    • DOT label truncated while tooltip keeps full name
    • JSON side panel details keep full untruncated name

All 6 tests pass in SparkPlanGraphSuite.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: GitHub Copilot (Claude Opus 4.6)

@yaooqinn yaooqinn marked this pull request as draft April 2, 2026 07:39
Truncate DOT graph node labels to 36 characters using middle-ellipsis
to prevent the plan visualization from becoming excessively wide when
node names contain long fully-qualified catalog.schema.table paths.

The full name remains available in the tooltip (hover) and the side
panel details (click).

Example:
  Before: ScanTransformer parquet spark_catalog.longschema.catalog_sales
  After:  ScanTransformer pa…catalog_sales

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yaooqinn
Copy link
Copy Markdown
Member Author

yaooqinn commented Apr 2, 2026

Screenshots

Plan visualization with truncated scan node labels:

Graph nodes show truncated labels with middle-ellipsis (...), keeping the operator prefix and table name:

  • Scan parquet spa...fault.fact_table (was: Scan parquet spark_catalog.default.fact_table)
  • Scan parquet spa...efault.dim_table (was: Scan parquet spark_catalog.default.dim_table)

Side panel shows full untruncated name on click:

Clicking a truncated node opens the side panel with the full name Scan parquet spark_catalog.default.fact_table and all metrics.

What's NOT truncated:

  • Short operator names: Sort, Filter, HashAggregate, BroadcastHashJoin, Project, Exchange — all unchanged
  • Labels without qualified paths — Execute InsertIntoHadoopFsRelationCommand stays full

Truncation only activates when:

  1. Label length > 36 characters, AND
  2. Label contains a dot-separated qualified name (word.word.word pattern)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant