Skip to content

[SPARK-56920][SQL][FOLLOWUP] Format METRIC_VIEW DESCRIBE output distinctly from VIEW#55983

Closed
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:cloud-fan/metric-view-describe-format
Closed

[SPARK-56920][SQL][FOLLOWUP] Format METRIC_VIEW DESCRIBE output distinctly from VIEW#55983
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:cloud-fan/metric-view-describe-format

Conversation

@cloud-fan
Copy link
Copy Markdown
Contributor

@cloud-fan cloud-fan commented May 19, 2026

What changes were proposed in this pull request?

CatalogTable.toJsonLinkedHashMap emits the view-binding fields (View Schema Mode, View Catalog and Namespace, SQL Path, View Query Output Columns, View Original Text) for any isViewLike table. After SPARK-56920 added METRIC_VIEW to isViewLike, those fields are now also emitted for metric views. None of them apply: a metric view's viewText is a YAML body (not a SQL query bound to a schema with schema-evolution mode), so those rows are at best inert and at worst misleading.

Narrow the view-binding block to tableType == CatalogTableType.VIEW, and give METRIC_VIEW its own branch that emits just View Text plus a Language: YAML tag so consumers can dispatch on the view_text format.

Why are the changes needed?

To make DESCRIBE TABLE EXTENDED AS JSON output for METRIC_VIEW accurately reflect its YAML nature, and avoid emitting SQL-view-specific binding fields that have no meaning for a metric view.

This also makes the call site fork-friendly: forks that extend isViewLike to include additional view-like kinds (materialized views, streaming tables, etc.) no longer accidentally inherit the SQL-view binding block for those kinds.

Does this PR introduce any user-facing change?

Yes. DESCRIBE TABLE EXTENDED AS JSON on a METRIC_VIEW:

  • No longer emits View Original Text, View Schema Mode, View Catalog and Namespace, SQL Path, or View Query Output Columns.
  • Now emits Language: YAML.
  • Still emits View Text (the YAML body).

How was this patch tested?

Compiles cleanly. Existing MetricViewV2CatalogSuite covers the v2-catalog path via DescribeV2ViewExec, not this v1 toJsonLinkedHashMap path, so it is unaffected.

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

No.

…nctly from VIEW

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

`CatalogTable.toJsonLinkedHashMap` emits the view-binding fields (`View
Schema Mode`, `View Catalog and Namespace`, `SQL Path`, `View Query
Output Columns`, `View Original Text`) for any `isViewLike` table. After
SPARK-54119 added `METRIC_VIEW` to `isViewLike`, those fields are now
also emitted for metric views. None of them apply: a metric view's
`viewText` is a YAML body (not a SQL query bound to a schema with
schema-evolution mode), so those rows are at best inert and at worst
misleading.

Narrow the view-binding block to `tableType == CatalogTableType.VIEW`,
and give `METRIC_VIEW` its own branch that emits just `View Text` plus a
`Language: YAML` tag so consumers can dispatch on the view_text format.

### Why are the changes needed?

To make `DESCRIBE TABLE EXTENDED AS JSON` output for `METRIC_VIEW`
accurately reflect its YAML nature, and avoid emitting SQL-view-specific
binding fields that have no meaning for a metric view.

This also makes the call site fork-friendly: forks that extend
`isViewLike` to include additional view-like kinds (materialized views,
streaming tables, etc.) no longer accidentally inherit the SQL-view
binding block for those kinds.

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

Yes. `DESCRIBE TABLE EXTENDED AS JSON` on a `METRIC_VIEW`:
- No longer emits `View Original Text`, `View Schema Mode`, `View
  Catalog and Namespace`, `SQL Path`, or `View Query Output Columns`.
- Now emits `Language: YAML`.
- Still emits `View Text` (the YAML body).

### How was this patch tested?

Compiles cleanly. Existing `MetricViewV2CatalogSuite` covers the v2-catalog
path via `DescribeV2ViewExec`, not this v1 `toJsonLinkedHashMap` path, so
it is unaffected.

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

No.
@cloud-fan
Copy link
Copy Markdown
Contributor Author

@cloud-fan
Copy link
Copy Markdown
Contributor Author

thanks for the review, merging to master/4.x/4.2!

@cloud-fan cloud-fan closed this in 10069a3 May 20, 2026
cloud-fan added a commit that referenced this pull request May 20, 2026
…nctly from VIEW

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

`CatalogTable.toJsonLinkedHashMap` emits the view-binding fields (`View Schema Mode`, `View Catalog and Namespace`, `SQL Path`, `View Query Output Columns`, `View Original Text`) for any `isViewLike` table. After SPARK-54119 added `METRIC_VIEW` to `isViewLike`, those fields are now also emitted for metric views. None of them apply: a metric view's `viewText` is a YAML body (not a SQL query bound to a schema with schema-evolution mode), so those rows are at best inert and at worst misleading.

Narrow the view-binding block to `tableType == CatalogTableType.VIEW`, and give `METRIC_VIEW` its own branch that emits just `View Text` plus a `Language: YAML` tag so consumers can dispatch on the view_text format.

### Why are the changes needed?

To make `DESCRIBE TABLE EXTENDED AS JSON` output for `METRIC_VIEW` accurately reflect its YAML nature, and avoid emitting SQL-view-specific binding fields that have no meaning for a metric view.

This also makes the call site fork-friendly: forks that extend `isViewLike` to include additional view-like kinds (materialized views, streaming tables, etc.) no longer accidentally inherit the SQL-view binding block for those kinds.

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

Yes. `DESCRIBE TABLE EXTENDED AS JSON` on a `METRIC_VIEW`:
- No longer emits `View Original Text`, `View Schema Mode`, `View Catalog and Namespace`, `SQL Path`, or `View Query Output Columns`.
- Now emits `Language: YAML`.
- Still emits `View Text` (the YAML body).

### How was this patch tested?

Compiles cleanly. Existing `MetricViewV2CatalogSuite` covers the v2-catalog path via `DescribeV2ViewExec`, not this v1 `toJsonLinkedHashMap` path, so it is unaffected.

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

No.

Closes #55983 from cloud-fan/cloud-fan/metric-view-describe-format.

Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 10069a3)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
cloud-fan added a commit that referenced this pull request May 20, 2026
…nctly from VIEW

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

`CatalogTable.toJsonLinkedHashMap` emits the view-binding fields (`View Schema Mode`, `View Catalog and Namespace`, `SQL Path`, `View Query Output Columns`, `View Original Text`) for any `isViewLike` table. After SPARK-54119 added `METRIC_VIEW` to `isViewLike`, those fields are now also emitted for metric views. None of them apply: a metric view's `viewText` is a YAML body (not a SQL query bound to a schema with schema-evolution mode), so those rows are at best inert and at worst misleading.

Narrow the view-binding block to `tableType == CatalogTableType.VIEW`, and give `METRIC_VIEW` its own branch that emits just `View Text` plus a `Language: YAML` tag so consumers can dispatch on the view_text format.

### Why are the changes needed?

To make `DESCRIBE TABLE EXTENDED AS JSON` output for `METRIC_VIEW` accurately reflect its YAML nature, and avoid emitting SQL-view-specific binding fields that have no meaning for a metric view.

This also makes the call site fork-friendly: forks that extend `isViewLike` to include additional view-like kinds (materialized views, streaming tables, etc.) no longer accidentally inherit the SQL-view binding block for those kinds.

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

Yes. `DESCRIBE TABLE EXTENDED AS JSON` on a `METRIC_VIEW`:
- No longer emits `View Original Text`, `View Schema Mode`, `View Catalog and Namespace`, `SQL Path`, or `View Query Output Columns`.
- Now emits `Language: YAML`.
- Still emits `View Text` (the YAML body).

### How was this patch tested?

Compiles cleanly. Existing `MetricViewV2CatalogSuite` covers the v2-catalog path via `DescribeV2ViewExec`, not this v1 `toJsonLinkedHashMap` path, so it is unaffected.

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

No.

Closes #55983 from cloud-fan/cloud-fan/metric-view-describe-format.

Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 10069a3)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@cloud-fan cloud-fan changed the title [SPARK-54119][SQL][FOLLOWUP] Format METRIC_VIEW DESCRIBE output distinctly from VIEW [SPARK-56920][SQL][FOLLOWUP] Format METRIC_VIEW DESCRIBE output distinctly from VIEW May 20, 2026
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.

2 participants