[
https://issues.apache.org/jira/browse/SPARK-60177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SPARK-60177:
-----------------------------------
Labels: pull-request-available (was: )
> CREATE OR REPLACE VIEW ... WITH METRICS fails on an existing metric view in
> the session catalog
> -----------------------------------------------------------------------------------------------
>
> Key: SPARK-60177
> URL: https://issues.apache.org/jira/browse/SPARK-60177
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 4.2.0
> Reporter: Lisa Cao
> Priority: Minor
> Labels: pull-request-available
>
> {{CREATE OR REPLACE VIEW ... WITH METRICS}} fails with
> {{TABLE_OR_VIEW_ALREADY_EXISTS}} when the metric view already exists in the
> session catalog, and the old definition stays. Regular {{CREATE OR REPLACE
> VIEW}} works.
> {code:sql}
> CREATE TABLE t USING parquet AS SELECT 'a' AS k;
> CREATE VIEW mv WITH METRICS LANGUAGE YAML AS $$
> version: "0.1"
> source: t
> dimensions:
> - name: k
> expr: k
> measures:
> - name: n
> expr: count(1)
> $$;
> -- same YAML, measure changed to count(1) + 100
> CREATE OR REPLACE VIEW mv WITH METRICS LANGUAGE YAML AS $$ ... $$;
> -- [TABLE_OR_VIEW_ALREADY_EXISTS] Cannot create table or view `default`.`mv`
> because it already exists.
> {code}
> Reproduced on 4.2.0 and 4.3.0-rc1 with the in-memory and Hive catalogs.
> {{createMetricViewInSessionCatalog}} never reads the {{replace}} flag; the v2
> path (SPARK-54119) handles it.
> Fix: when the target exists, drop and recreate the way {{CreateViewCommand}}
> does. Workaround: DROP VIEW, then CREATE VIEW.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]