This is an automated email from the ASF dual-hosted git repository.

uros-b pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 567cf28dc063 [SPARK-60700][SQL][TEST] Add DROP VIEW SQL golden tests
567cf28dc063 is described below

commit 567cf28dc063610e0a90eaaf069d389e23c5c489
Author: Vladan Vasić <[email protected]>
AuthorDate: Thu Oct 29 19:09:39 2026 +0000

    [SPARK-60700][SQL][TEST] Add DROP VIEW SQL golden tests
    
    ### What changes were proposed in this pull request?
    
    JIRA: [SPARK-60700](https://issues.apache.org/jira/browse/SPARK-60700)
    
    Add `drop-view.sql` with 44 SQL statements and generated execution and 
analyzer goldens.
    
    The cases cover local and global temporary views, persistent views, 
temporary-view shadowing,
    missing objects and `IF EXISTS`, table/view type mismatches, `IDENTIFIER` 
expressions and session
    variables, malformed multipart names, `EXPLAIN`, and session-qualified 
temporary views.
    
    ### Why are the changes needed?
    
    Provide focused golden coverage for the existing `DROP VIEW` behavior, 
including name resolution,
    analyzed plans, and error conditions, so future analyzer changes can be 
checked against it.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. Tests only; no production code changes.
    
    ### How was this patch tested?
    
    Added the SQL input and generated both golden files with:
    
    ```sh
    SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
      "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z drop-view.sql"
    ```
    
    Verified without golden generation:
    
    ```sh
    build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z 
drop-view.sql"
    ```
    
    Both `drop-view.sql` and `drop-view.sql_analyzer_test` passed on Java 17.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: OpenAI Codex CLI 0.165.0
    
    Closes #59912 from vladanvasi-db/vladanvasi-db/drop-view-golden-tests.
    
    Authored-by: Vladan Vasić <[email protected]>
    Signed-off-by: Uros Bojanic <[email protected]>
---
 .../sql-tests/analyzer-results/drop-view.sql.out   | 414 ++++++++++++++++++
 .../test/resources/sql-tests/inputs/drop-view.sql  |  68 +++
 .../resources/sql-tests/results/drop-view.sql.out  | 469 +++++++++++++++++++++
 3 files changed, 951 insertions(+)

diff --git 
a/sql/core/src/test/resources/sql-tests/analyzer-results/drop-view.sql.out 
b/sql/core/src/test/resources/sql-tests/analyzer-results/drop-view.sql.out
new file mode 100644
index 000000000000..64bf3e26ab22
--- /dev/null
+++ b/sql/core/src/test/resources/sql-tests/analyzer-results/drop-view.sql.out
@@ -0,0 +1,414 @@
+-- Automatically generated by SQLQueryTestSuite
+-- !query
+CREATE TEMPORARY VIEW drop_view_v1 AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `drop_view_v1`, SELECT 1 AS c, false, false, LocalTempView, 
UNSUPPORTED, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW drop_view_v1
+-- !query analysis
+DropTempViewCommand drop_view_v1, false
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_v1
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_v1`, true, true, false
+
+
+-- !query
+DROP VIEW drop_view_v1
+-- !query analysis
+org.apache.spark.sql.catalyst.analysis.NoSuchTableException
+{
+  "errorClass" : "TABLE_OR_VIEW_NOT_FOUND",
+  "sqlState" : "42P01",
+  "messageParameters" : {
+    "relationName" : "`spark_catalog`.`default`.`drop_view_v1`",
+    "searchPath" : "[`spark_catalog`.`default`]"
+  }
+}
+
+
+-- !query
+DROP VIEW drop_view_missing
+-- !query analysis
+org.apache.spark.sql.catalyst.analysis.NoSuchTableException
+{
+  "errorClass" : "TABLE_OR_VIEW_NOT_FOUND",
+  "sqlState" : "42P01",
+  "messageParameters" : {
+    "relationName" : "`spark_catalog`.`default`.`drop_view_missing`",
+    "searchPath" : "[`spark_catalog`.`default`]"
+  }
+}
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_missing
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_missing`, true, true, 
false
+
+
+-- !query
+CREATE GLOBAL TEMPORARY VIEW drop_view_gv1 AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `drop_view_gv1`, SELECT 1 AS c, false, false, 
GlobalTempView, UNSUPPORTED, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW global_temp.drop_view_gv1
+-- !query analysis
+DropTempViewCommand global_temp.drop_view_gv1, false
+
+
+-- !query
+DROP VIEW IF EXISTS global_temp.drop_view_gv1
+-- !query analysis
+DropTableCommand `spark_catalog`.`global_temp`.`drop_view_gv1`, true, true, 
false
+
+
+-- !query
+CREATE VIEW drop_view_pv1 AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `spark_catalog`.`default`.`drop_view_pv1`, SELECT 1 AS c, 
false, false, PersistedView, COMPENSATION, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW drop_view_pv1
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_pv1`, false, true, false
+
+
+-- !query
+CREATE VIEW drop_view_pv2 AS SELECT 2 AS c
+-- !query analysis
+CreateViewCommand `spark_catalog`.`default`.`drop_view_pv2`, SELECT 2 AS c, 
false, false, PersistedView, COMPENSATION, true
+   +- Project [2 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW default.drop_view_pv2
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_pv2`, false, true, false
+
+
+-- !query
+CREATE VIEW drop_view_sh AS SELECT 2 AS c
+-- !query analysis
+CreateViewCommand `spark_catalog`.`default`.`drop_view_sh`, SELECT 2 AS c, 
false, false, PersistedView, COMPENSATION, true
+   +- Project [2 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+CREATE TEMPORARY VIEW drop_view_sh AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `drop_view_sh`, SELECT 1 AS c, false, false, LocalTempView, 
UNSUPPORTED, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+SELECT * FROM drop_view_sh
+-- !query analysis
+Project [c#x]
++- SubqueryAlias drop_view_sh
+   +- View (`drop_view_sh`, [c#x])
+      +- Project [cast(c#x as int) AS c#x]
+         +- Project [1 AS c#x]
+            +- OneRowRelation
+
+
+-- !query
+DROP VIEW drop_view_sh
+-- !query analysis
+DropTempViewCommand drop_view_sh, false
+
+
+-- !query
+SELECT * FROM drop_view_sh
+-- !query analysis
+Project [c#x]
++- SubqueryAlias spark_catalog.default.drop_view_sh
+   +- View (`spark_catalog`.`default`.`drop_view_sh`, [c#x])
+      +- Project [cast(c#x as int) AS c#x]
+         +- Project [2 AS c#x]
+            +- OneRowRelation
+
+
+-- !query
+DROP VIEW default.drop_view_sh
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_sh`, false, true, false
+
+
+-- !query
+CREATE TABLE drop_view_t1 (c INT) USING parquet
+-- !query analysis
+CreateDataSourceTableCommand `spark_catalog`.`default`.`drop_view_t1`, false
+
+
+-- !query
+DROP VIEW drop_view_t1
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "WRONG_COMMAND_FOR_OBJECT_TYPE",
+  "sqlState" : "42809",
+  "messageParameters" : {
+    "alternative" : "DROP TABLE",
+    "foundType" : "MANAGED",
+    "objectName" : "spark_catalog.default.drop_view_t1",
+    "operation" : "DROP VIEW",
+    "requiredType" : "VIEW or METRIC_VIEW"
+  }
+}
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_t1
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "WRONG_COMMAND_FOR_OBJECT_TYPE",
+  "sqlState" : "42809",
+  "messageParameters" : {
+    "alternative" : "DROP TABLE",
+    "foundType" : "MANAGED",
+    "objectName" : "spark_catalog.default.drop_view_t1",
+    "operation" : "DROP VIEW",
+    "requiredType" : "VIEW or METRIC_VIEW"
+  }
+}
+
+
+-- !query
+DROP TABLE drop_view_t1
+-- !query analysis
+DropTable false, false
++- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.drop_view_t1
+
+
+-- !query
+CREATE VIEW drop_view_id1 AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `spark_catalog`.`default`.`drop_view_id1`, SELECT 1 AS c, 
false, false, PersistedView, COMPENSATION, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW IDENTIFIER('drop_view_id1')
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_id1`, false, true, false
+
+
+-- !query
+CREATE VIEW drop_view_concat AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `spark_catalog`.`default`.`drop_view_concat`, SELECT 1 AS c, 
false, false, PersistedView, COMPENSATION, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW IDENTIFIER('drop_view_' || 'concat')
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_concat`, false, true, 
false
+
+
+-- !query
+CREATE VIEW drop_view_var_v AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `spark_catalog`.`default`.`drop_view_var_v`, SELECT 1 AS c, 
false, false, PersistedView, COMPENSATION, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DECLARE VARIABLE drop_view_var STRING DEFAULT 'drop_view_var_v'
+-- !query analysis
+CreateVariable default(cast(drop_view_var_v as string), 
sql=''drop_view_var_v''), false
++- ResolvedIdentifier 
org.apache.spark.sql.catalyst.analysis.FakeSystemCatalog$@xxxxxxxx, 
session.drop_view_var
+
+
+-- !query
+DROP VIEW IDENTIFIER(drop_view_var)
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_var_v`, false, true, 
false
+
+
+-- !query
+DROP TEMPORARY VARIABLE drop_view_var
+-- !query analysis
+DropVariable false
++- ResolvedIdentifier 
org.apache.spark.sql.catalyst.analysis.FakeSystemCatalog$@xxxxxxxx, 
session.drop_view_var
+
+
+-- !query
+DROP VIEW IDENTIFIER(1)
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.WRONG_TYPE",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "dataType" : "int",
+    "expr" : "1",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 22,
+    "stopIndex" : 22,
+    "fragment" : "1"
+  } ]
+}
+
+
+-- !query
+DROP VIEW IDENTIFIER(cast(null AS STRING))
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.NULL",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "expr" : "CAST(NULL AS STRING)",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 22,
+    "stopIndex" : 41,
+    "fragment" : "cast(null AS STRING)"
+  } ]
+}
+
+
+-- !query
+DROP VIEW IDENTIFIER(rand())
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.NOT_CONSTANT",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "expr" : "rand()",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 22,
+    "stopIndex" : 27,
+    "fragment" : "rand()"
+  } ]
+}
+
+
+-- !query
+DROP VIEW IF EXISTS IDENTIFIER(1)
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.WRONG_TYPE",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "dataType" : "int",
+    "expr" : "1",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 32,
+    "stopIndex" : 32,
+    "fragment" : "1"
+  } ]
+}
+
+
+-- !query
+DROP VIEW global_temp.drop_view_a.drop_view_b
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "REQUIRES_SINGLE_PART_NAMESPACE",
+  "sqlState" : "42K05",
+  "messageParameters" : {
+    "identifier" : "`global_temp`.`drop_view_a`.`drop_view_b`",
+    "sessionCatalog" : "spark_catalog"
+  }
+}
+
+
+-- !query
+DROP VIEW IF EXISTS global_temp.drop_view_a.drop_view_b
+-- !query analysis
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "REQUIRES_SINGLE_PART_NAMESPACE",
+  "sqlState" : "42K05",
+  "messageParameters" : {
+    "identifier" : "`global_temp`.`drop_view_a`.`drop_view_b`",
+    "sessionCatalog" : "spark_catalog"
+  }
+}
+
+
+-- !query
+EXPLAIN DROP VIEW IF EXISTS drop_view_missing
+-- !query analysis
+ExplainCommand 'DropView true, SimpleMode
+
+
+-- !query
+CREATE TEMPORARY VIEW drop_view_s1 AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `drop_view_s1`, SELECT 1 AS c, false, false, LocalTempView, 
UNSUPPORTED, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW session.drop_view_s1
+-- !query analysis
+DropTempViewCommand session.drop_view_s1, false
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_s1
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_s1`, true, true, false
+
+
+-- !query
+CREATE TEMPORARY VIEW drop_view_s2 AS SELECT 1 AS c
+-- !query analysis
+CreateViewCommand `drop_view_s2`, SELECT 1 AS c, false, false, LocalTempView, 
UNSUPPORTED, true
+   +- Project [1 AS c#x]
+      +- OneRowRelation
+
+
+-- !query
+DROP VIEW system.session.drop_view_s2
+-- !query analysis
+DropTempViewCommand system.session.drop_view_s2, false
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_s2
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`drop_view_s2`, true, true, false
diff --git a/sql/core/src/test/resources/sql-tests/inputs/drop-view.sql 
b/sql/core/src/test/resources/sql-tests/inputs/drop-view.sql
new file mode 100644
index 000000000000..e077a3deec11
--- /dev/null
+++ b/sql/core/src/test/resources/sql-tests/inputs/drop-view.sql
@@ -0,0 +1,68 @@
+-- DROP VIEW on a temporary view, then IF EXISTS and DROP VIEW on the missing 
view.
+CREATE TEMPORARY VIEW drop_view_v1 AS SELECT 1 AS c;
+DROP VIEW drop_view_v1;
+DROP VIEW IF EXISTS drop_view_v1;
+DROP VIEW drop_view_v1;
+
+-- DROP VIEW on a missing view, with and without IF EXISTS.
+DROP VIEW drop_view_missing;
+DROP VIEW IF EXISTS drop_view_missing;
+
+-- DROP VIEW on a global temporary view, then IF EXISTS after it is gone.
+CREATE GLOBAL TEMPORARY VIEW drop_view_gv1 AS SELECT 1 AS c;
+DROP VIEW global_temp.drop_view_gv1;
+DROP VIEW IF EXISTS global_temp.drop_view_gv1;
+
+-- DROP VIEW on a persistent view, unqualified and with a database qualifier.
+CREATE VIEW drop_view_pv1 AS SELECT 1 AS c;
+DROP VIEW drop_view_pv1;
+CREATE VIEW drop_view_pv2 AS SELECT 2 AS c;
+DROP VIEW default.drop_view_pv2;
+
+-- A temporary view shadows a persistent view of the same name. The 
unqualified DROP VIEW
+-- drops the temporary view, and the qualified DROP VIEW drops the persistent 
view.
+CREATE VIEW drop_view_sh AS SELECT 2 AS c;
+CREATE TEMPORARY VIEW drop_view_sh AS SELECT 1 AS c;
+SELECT * FROM drop_view_sh;
+DROP VIEW drop_view_sh;
+SELECT * FROM drop_view_sh;
+DROP VIEW default.drop_view_sh;
+
+-- DROP VIEW and DROP VIEW IF EXISTS on a table.
+CREATE TABLE drop_view_t1 (c INT) USING parquet;
+DROP VIEW drop_view_t1;
+DROP VIEW IF EXISTS drop_view_t1;
+DROP TABLE drop_view_t1;
+
+-- DROP VIEW with an IDENTIFIER clause, with a literal and with a concatenated 
string.
+CREATE VIEW drop_view_id1 AS SELECT 1 AS c;
+DROP VIEW IDENTIFIER('drop_view_id1');
+CREATE VIEW drop_view_concat AS SELECT 1 AS c;
+DROP VIEW IDENTIFIER('drop_view_' || 'concat');
+
+-- DROP VIEW with an IDENTIFIER clause over a session variable.
+CREATE VIEW drop_view_var_v AS SELECT 1 AS c;
+DECLARE VARIABLE drop_view_var STRING DEFAULT 'drop_view_var_v';
+DROP VIEW IDENTIFIER(drop_view_var);
+DROP TEMPORARY VARIABLE drop_view_var;
+
+-- DROP VIEW with IDENTIFIER arguments that are not a constant non-null string.
+DROP VIEW IDENTIFIER(1);
+DROP VIEW IDENTIFIER(cast(null AS STRING));
+DROP VIEW IDENTIFIER(rand());
+DROP VIEW IF EXISTS IDENTIFIER(1);
+
+-- DROP VIEW with a global_temp name that has more than two parts, with and 
without IF EXISTS.
+DROP VIEW global_temp.drop_view_a.drop_view_b;
+DROP VIEW IF EXISTS global_temp.drop_view_a.drop_view_b;
+
+-- EXPLAIN of DROP VIEW IF EXISTS on a missing view.
+EXPLAIN DROP VIEW IF EXISTS drop_view_missing;
+
+-- DROP VIEW on session-qualified temporary views.
+CREATE TEMPORARY VIEW drop_view_s1 AS SELECT 1 AS c;
+DROP VIEW session.drop_view_s1;
+DROP VIEW IF EXISTS drop_view_s1;
+CREATE TEMPORARY VIEW drop_view_s2 AS SELECT 1 AS c;
+DROP VIEW system.session.drop_view_s2;
+DROP VIEW IF EXISTS drop_view_s2;
diff --git a/sql/core/src/test/resources/sql-tests/results/drop-view.sql.out 
b/sql/core/src/test/resources/sql-tests/results/drop-view.sql.out
new file mode 100644
index 000000000000..2e3f6660d1e8
--- /dev/null
+++ b/sql/core/src/test/resources/sql-tests/results/drop-view.sql.out
@@ -0,0 +1,469 @@
+-- Automatically generated by SQLQueryTestSuite
+-- !query
+CREATE TEMPORARY VIEW drop_view_v1 AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW drop_view_v1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_v1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW drop_view_v1
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.catalyst.analysis.NoSuchTableException
+{
+  "errorClass" : "TABLE_OR_VIEW_NOT_FOUND",
+  "sqlState" : "42P01",
+  "messageParameters" : {
+    "relationName" : "`spark_catalog`.`default`.`drop_view_v1`",
+    "searchPath" : "[`spark_catalog`.`default`]"
+  }
+}
+
+
+-- !query
+DROP VIEW drop_view_missing
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.catalyst.analysis.NoSuchTableException
+{
+  "errorClass" : "TABLE_OR_VIEW_NOT_FOUND",
+  "sqlState" : "42P01",
+  "messageParameters" : {
+    "relationName" : "`spark_catalog`.`default`.`drop_view_missing`",
+    "searchPath" : "[`spark_catalog`.`default`]"
+  }
+}
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_missing
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE GLOBAL TEMPORARY VIEW drop_view_gv1 AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW global_temp.drop_view_gv1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IF EXISTS global_temp.drop_view_gv1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW drop_view_pv1 AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW drop_view_pv1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW drop_view_pv2 AS SELECT 2 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW default.drop_view_pv2
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW drop_view_sh AS SELECT 2 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TEMPORARY VIEW drop_view_sh AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SELECT * FROM drop_view_sh
+-- !query schema
+struct<c:int>
+-- !query output
+1
+
+
+-- !query
+DROP VIEW drop_view_sh
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SELECT * FROM drop_view_sh
+-- !query schema
+struct<c:int>
+-- !query output
+2
+
+
+-- !query
+DROP VIEW default.drop_view_sh
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TABLE drop_view_t1 (c INT) USING parquet
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW drop_view_t1
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "WRONG_COMMAND_FOR_OBJECT_TYPE",
+  "sqlState" : "42809",
+  "messageParameters" : {
+    "alternative" : "DROP TABLE",
+    "foundType" : "MANAGED",
+    "objectName" : "spark_catalog.default.drop_view_t1",
+    "operation" : "DROP VIEW",
+    "requiredType" : "VIEW or METRIC_VIEW"
+  }
+}
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_t1
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "WRONG_COMMAND_FOR_OBJECT_TYPE",
+  "sqlState" : "42809",
+  "messageParameters" : {
+    "alternative" : "DROP TABLE",
+    "foundType" : "MANAGED",
+    "objectName" : "spark_catalog.default.drop_view_t1",
+    "operation" : "DROP VIEW",
+    "requiredType" : "VIEW or METRIC_VIEW"
+  }
+}
+
+
+-- !query
+DROP TABLE drop_view_t1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW drop_view_id1 AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IDENTIFIER('drop_view_id1')
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW drop_view_concat AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IDENTIFIER('drop_view_' || 'concat')
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW drop_view_var_v AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DECLARE VARIABLE drop_view_var STRING DEFAULT 'drop_view_var_v'
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IDENTIFIER(drop_view_var)
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP TEMPORARY VARIABLE drop_view_var
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IDENTIFIER(1)
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.WRONG_TYPE",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "dataType" : "int",
+    "expr" : "1",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 22,
+    "stopIndex" : 22,
+    "fragment" : "1"
+  } ]
+}
+
+
+-- !query
+DROP VIEW IDENTIFIER(cast(null AS STRING))
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.NULL",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "expr" : "CAST(NULL AS STRING)",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 22,
+    "stopIndex" : 41,
+    "fragment" : "cast(null AS STRING)"
+  } ]
+}
+
+
+-- !query
+DROP VIEW IDENTIFIER(rand())
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.NOT_CONSTANT",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "expr" : "rand()",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 22,
+    "stopIndex" : 27,
+    "fragment" : "rand()"
+  } ]
+}
+
+
+-- !query
+DROP VIEW IF EXISTS IDENTIFIER(1)
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "NOT_A_CONSTANT_STRING.WRONG_TYPE",
+  "sqlState" : "42601",
+  "messageParameters" : {
+    "dataType" : "int",
+    "expr" : "1",
+    "name" : "IDENTIFIER"
+  },
+  "queryContext" : [ {
+    "objectType" : "",
+    "objectName" : "",
+    "startIndex" : 32,
+    "stopIndex" : 32,
+    "fragment" : "1"
+  } ]
+}
+
+
+-- !query
+DROP VIEW global_temp.drop_view_a.drop_view_b
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "REQUIRES_SINGLE_PART_NAMESPACE",
+  "sqlState" : "42K05",
+  "messageParameters" : {
+    "identifier" : "`global_temp`.`drop_view_a`.`drop_view_b`",
+    "sessionCatalog" : "spark_catalog"
+  }
+}
+
+
+-- !query
+DROP VIEW IF EXISTS global_temp.drop_view_a.drop_view_b
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+{
+  "errorClass" : "REQUIRES_SINGLE_PART_NAMESPACE",
+  "sqlState" : "42K05",
+  "messageParameters" : {
+    "identifier" : "`global_temp`.`drop_view_a`.`drop_view_b`",
+    "sessionCatalog" : "spark_catalog"
+  }
+}
+
+
+-- !query
+EXPLAIN DROP VIEW IF EXISTS drop_view_missing
+-- !query schema
+struct<plan:string>
+-- !query output
+== Physical Plan ==
+Execute DropTableCommand
+   +- DropTableCommand `spark_catalog`.`default`.`drop_view_missing`, true, 
true, false
+
+
+-- !query
+CREATE TEMPORARY VIEW drop_view_s1 AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW session.drop_view_s1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_s1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TEMPORARY VIEW drop_view_s2 AS SELECT 1 AS c
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW system.session.drop_view_s2
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW IF EXISTS drop_view_s2
+-- !query schema
+struct<>
+-- !query output
+


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to