John Zhuge created SPARK-30118:
----------------------------------

             Summary: ALTER VIEW QUERY does not work
                 Key: SPARK-30118
                 URL: https://issues.apache.org/jira/browse/SPARK-30118
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: John Zhuge


`ALTER VIEW AS` does not change view query. It leaves the view in a corrupted 
state.
{code:sql}
spark-sql> CREATE VIEW jzhuge.v1 AS SELECT 'foo' foo1;
spark-sql> SHOW CREATE TABLE jzhuge.v1;
CREATE VIEW `jzhuge`.`v1`(foo1) AS
SELECT 'foo' foo1

spark-sql> ALTER VIEW jzhuge.v1 AS SELECT 'foo' foo2;
spark-sql> SHOW CREATE TABLE jzhuge.v1;
CREATE VIEW `jzhuge`.`v1`(foo1) AS
SELECT 'foo' foo1

spark-sql> TABLE jzhuge.v1;
Error in query: Attribute with name 'foo2' is not found in '(foo1)';;
SubqueryAlias `jzhuge`.`v1`
+- View (`jzhuge`.`v1`, [foo1#33])
   +- Project [foo AS foo1#34]
      +- OneRowRelation
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to