[SPARK-56920][SQL][FOLLOWUP] Format METRIC_VIEW DESCRIBE output distinctly from VIEW#55983
Closed
cloud-fan wants to merge 1 commit into
Closed
[SPARK-56920][SQL][FOLLOWUP] Format METRIC_VIEW DESCRIBE output distinctly from VIEW#55983cloud-fan wants to merge 1 commit into
cloud-fan wants to merge 1 commit into
Conversation
…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.
Contributor
Author
zhengruifeng
approved these changes
May 20, 2026
Contributor
Author
|
thanks for the review, merging to master/4.x/4.2! |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
CatalogTable.toJsonLinkedHashMapemits the view-binding fields (View Schema Mode,View Catalog and Namespace,SQL Path,View Query Output Columns,View Original Text) for anyisViewLiketable. After SPARK-56920 addedMETRIC_VIEWtoisViewLike, those fields are now also emitted for metric views. None of them apply: a metric view'sviewTextis 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 giveMETRIC_VIEWits own branch that emits justView Textplus aLanguage: YAMLtag so consumers can dispatch on the view_text format.Why are the changes needed?
To make
DESCRIBE TABLE EXTENDED AS JSONoutput forMETRIC_VIEWaccurately 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
isViewLiketo 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 JSONon aMETRIC_VIEW:View Original Text,View Schema Mode,View Catalog and Namespace,SQL Path, orView Query Output Columns.Language: YAML.View Text(the YAML body).How was this patch tested?
Compiles cleanly. Existing
MetricViewV2CatalogSuitecovers the v2-catalog path viaDescribeV2ViewExec, not this v1toJsonLinkedHashMappath, so it is unaffected.Was this patch authored or co-authored using generative AI tooling?
No.