Skip to content

[SPARK-57987][SQL] Expose modifiedConfigs and node description in SQL REST API#57066

Closed
ulysses-you wants to merge 3 commits into
apache:masterfrom
ulysses-you:sqlresource
Closed

[SPARK-57987][SQL] Expose modifiedConfigs and node description in SQL REST API#57066
ulysses-you wants to merge 3 commits into
apache:masterfrom
ulysses-you:sqlresource

Conversation

@ulysses-you

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR exposes two additional fields in the SQL REST API (/api/v1/applications/[app-id]/sql/[execution-id]):

  • modifiedConfigs on ExecutionData -- the SQL configs modified for the execution, sourced from SQLExecutionUIData.modifiedConfigs.
  • desc on Node -- the physical plan node description, sourced from SparkPlanGraphNode.desc.

Why are the changes needed?

The SQL REST API already surfaces plan and metric information, but callers cannot see which configs were modified for a given execution, nor the per-node description string. Exposing these makes the REST API self-sufficient for tooling that inspects executions without scraping the Web UI.

Does this PR introduce any user-facing change?

Yes. Two new fields are added to the SQL REST API response: modifiedConfigs (map) on the execution object and desc (string) on each plan node. Both default to empty/absent, so existing consumers are unaffected.

How was this patch tested?

Extended SqlResourceSuite to populate and assert both fields (node desc via the details = true cases, and modifiedConfigs via verifyExpectedExecutionData). All 7 tests in the suite pass.

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

Generated-by: Claude Code (Claude Opus 4.8)

🤖 Generated with Claude Code

… REST API

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

import org.apache.spark.sql.execution.ui.SparkPlanGraphEdge

case class Metric private[spark] (name: String, value: String)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reorder the class code position to Metric -> Node -> ExecutionData to make compile happy sometimes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so essential change here are:

  • add desc: String = null to case class Node
  • add val modifiedConfigs: Map[String, String] = Map.empty) to class ExecutionData

how about also exposing planId to Node, I found that sometimes the LLM might confuse about nodeId and planId

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have a planId field here. Maybe we can add it in other pr.

@ulysses-you

Copy link
Copy Markdown
Contributor Author

cc @cloud-fan @yaooqinn @sarutak thank you

@sarutak sarutak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to add a test case where modifiedConfigs is empty (Map.empty) and/or desc is null, to verify the JSON serialization behavior for default values. Not a blocker since existing fields (queryId, errorMessage) don't have equivalent tests either.

Comment thread project/MimaExcludes.scala Outdated
"org.apache.spark.ml.recommendation.ALS.getIntermediateStorageLevel")
"org.apache.spark.ml.recommendation.ALS.getIntermediateStorageLevel"),
// [SPARK-57987] Add desc field to the SQL REST API Node case class
ProblemFilters.exclude[Problem]("org.apache.spark.status.api.v1.sql.Node*")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we narrow this to specific problem types?
This would still allow MiMa to catch unexpected issues (like class removal) while permitting the case class field addition. Not blocking, just a suggestion for future-proofing.

@ulysses-you

Copy link
Copy Markdown
Contributor Author

thank you @sarutak , addressed comment

ulysses-you added a commit that referenced this pull request Jul 8, 2026
… REST API

### What changes were proposed in this pull request?

This PR exposes two additional fields in the SQL REST API (`/api/v1/applications/[app-id]/sql/[execution-id]`):

- `modifiedConfigs` on `ExecutionData` -- the SQL configs modified for the execution, sourced from `SQLExecutionUIData.modifiedConfigs`.
- `desc` on `Node` -- the physical plan node description, sourced from `SparkPlanGraphNode.desc`.

### Why are the changes needed?

The SQL REST API already surfaces plan and metric information, but callers cannot see which configs were modified for a given execution, nor the per-node description string. Exposing these makes the REST API self-sufficient for tooling that inspects executions without scraping the Web UI.

### Does this PR introduce _any_ user-facing change?

Yes. Two new fields are added to the SQL REST API response: `modifiedConfigs` (map) on the execution object and `desc` (string) on each plan node. Both default to empty/absent, so existing consumers are unaffected.

### How was this patch tested?

Extended `SqlResourceSuite` to populate and assert both fields (node `desc` via the `details = true` cases, and `modifiedConfigs` via `verifyExpectedExecutionData`). All 7 tests in the suite pass.

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

Generated-by: Claude Code (Claude Opus 4.8)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Closes #57066 from ulysses-you/sqlresource.

Authored-by: Xiduo You <ulyssesyou18@gmail.com>
Signed-off-by: Xiduo You <ulyssesyou@apache.org>
(cherry picked from commit f2f6bde)
Signed-off-by: Xiduo You <ulyssesyou@apache.org>
@ulysses-you

Copy link
Copy Markdown
Contributor Author

Merge Summary:

Posted by merge_spark_pr.py

@ulysses-you

Copy link
Copy Markdown
Contributor Author

thank you all for review!

@ulysses-you ulysses-you deleted the sqlresource branch July 8, 2026 06:06
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.

3 participants