You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ya...@apache.org on 2025/02/25 02:00:41 UTC

(spark) branch branch-4.0 updated: [SPARK-51306][TESTS] Fix test errors caused by improper DROP TABLE/VIEW in describe.sql

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

yao pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 2f355128323a [SPARK-51306][TESTS] Fix test errors caused by improper DROP TABLE/VIEW in describe.sql
2f355128323a is described below

commit 2f355128323a27109d4b927b0008b60c270b7d75
Author: Kent Yao <ya...@apache.org>
AuthorDate: Tue Feb 25 09:59:36 2025 +0800

    [SPARK-51306][TESTS] Fix test errors caused by improper DROP TABLE/VIEW in describe.sql
    
    ### What changes were proposed in this pull request?
    
    This PR fixes test errors caused by improper DROP TABLE/VIEW in describe.sql
    
    - Table Not Found Error when dropping views after dropping the base table
    - Table Already Exists Error w/o proper drop
    
    ### Why are the changes needed?
    test fix
    
    ### Does this PR introduce _any_ user-facing change?
    no
    
    ### How was this patch tested?
    
    the existing tests
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #50061 from yaooqinn/minor.
    
    Authored-by: Kent Yao <ya...@apache.org>
    Signed-off-by: Kent Yao <ya...@apache.org>
    (cherry picked from commit 352d1ed84db24f8d390d82c85685b507484dd503)
    Signed-off-by: Kent Yao <ya...@apache.org>
---
 .../sql-tests/analyzer-results/describe.sql.out    | 82 +++++++++++-----------
 .../test/resources/sql-tests/inputs/describe.sql   | 22 +++---
 .../resources/sql-tests/results/describe.sql.out   | 80 ++++++++++++---------
 3 files changed, 102 insertions(+), 82 deletions(-)

diff --git a/sql/core/src/test/resources/sql-tests/analyzer-results/describe.sql.out b/sql/core/src/test/resources/sql-tests/analyzer-results/describe.sql.out
index 307a0a3e25fb..c13dd5302387 100644
--- a/sql/core/src/test/resources/sql-tests/analyzer-results/describe.sql.out
+++ b/sql/core/src/test/resources/sql-tests/analyzer-results/describe.sql.out
@@ -333,42 +333,10 @@ EXPLAIN DESCRIBE EXTENDED t PARTITION (c='Us', d=2) AS JSON
 ExplainCommand 'DescribeRelationJsonCommand [c=Us, d=2], true, [json_metadata#x], SimpleMode
 
 
--- !query
-DROP TABLE t
--- !query analysis
-DropTable false, false
-+- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.t
-
-
--- !query
-DROP VIEW temp_v
--- !query analysis
-DropTempViewCommand temp_v
-
-
--- !query
-DROP VIEW temp_Data_Source_View
--- !query analysis
-DropTempViewCommand temp_Data_Source_View
-
-
--- !query
-DROP VIEW v
--- !query analysis
-DropTableCommand `spark_catalog`.`default`.`v`, false, true, false
-
-
 -- !query
 CREATE TABLE d (a STRING DEFAULT 'default-value', b INT DEFAULT 42) USING parquet COMMENT 'table_comment'
 -- !query analysis
-org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
-{
-  "errorClass" : "TABLE_OR_VIEW_ALREADY_EXISTS",
-  "sqlState" : "42P07",
-  "messageParameters" : {
-    "relationName" : "`spark_catalog`.`default`.`d`"
-  }
-}
+CreateDataSourceTableCommand `spark_catalog`.`default`.`d`, false
 
 
 -- !query
@@ -398,14 +366,7 @@ DescribeTableCommand `spark_catalog`.`default`.`d`, true, [col_name#x, data_type
 -- !query
 CREATE TABLE e (a STRING DEFAULT CONCAT('a\n b\n ', 'c\n d'), b INT DEFAULT 42) USING parquet COMMENT 'table_comment'
 -- !query analysis
-org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException
-{
-  "errorClass" : "TABLE_OR_VIEW_ALREADY_EXISTS",
-  "sqlState" : "42P07",
-  "messageParameters" : {
-    "relationName" : "`spark_catalog`.`default`.`e`"
-  }
-}
+CreateDataSourceTableCommand `spark_catalog`.`default`.`e`, false
 
 
 -- !query
@@ -430,3 +391,42 @@ DescribeTableCommand `spark_catalog`.`default`.`e`, true, [col_name#x, data_type
 DESC FORMATTED e
 -- !query analysis
 DescribeTableCommand `spark_catalog`.`default`.`e`, true, [col_name#x, data_type#x, comment#x]
+
+
+-- !query
+DROP VIEW temp_v
+-- !query analysis
+DropTempViewCommand temp_v
+
+
+-- !query
+DROP VIEW temp_Data_Source_View
+-- !query analysis
+DropTempViewCommand temp_Data_Source_View
+
+
+-- !query
+DROP VIEW v
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`v`, false, true, false
+
+
+-- !query
+DROP TABLE t
+-- !query analysis
+DropTable false, false
++- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.t
+
+
+-- !query
+DROP TABLE d
+-- !query analysis
+DropTable false, false
++- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.d
+
+
+-- !query
+DROP TABLE e
+-- !query analysis
+DropTable false, false
++- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.e
diff --git a/sql/core/src/test/resources/sql-tests/inputs/describe.sql b/sql/core/src/test/resources/sql-tests/inputs/describe.sql
index aa6f38defdec..dd7f7c40ed52 100644
--- a/sql/core/src/test/resources/sql-tests/inputs/describe.sql
+++ b/sql/core/src/test/resources/sql-tests/inputs/describe.sql
@@ -100,15 +100,6 @@ EXPLAIN DESCRIBE t b;
 EXPLAIN DESCRIBE t PARTITION (c='Us', d=2);
 EXPLAIN DESCRIBE EXTENDED t PARTITION (c='Us', d=2) AS JSON;
 
--- DROP TEST TABLES/VIEWS
-DROP TABLE t;
-
-DROP VIEW temp_v;
-
-DROP VIEW temp_Data_Source_View;
-
-DROP VIEW v;
-
 -- Show column default values
 CREATE TABLE d (a STRING DEFAULT 'default-value', b INT DEFAULT 42) USING parquet COMMENT 'table_comment';
 
@@ -131,3 +122,16 @@ DESC TABLE EXTENDED e;
 
 DESC FORMATTED e;
 
+-- DROP TEST TABLES/VIEWS
+
+DROP VIEW temp_v;
+
+DROP VIEW temp_Data_Source_View;
+
+DROP VIEW v;
+
+DROP TABLE t;
+
+DROP TABLE d;
+
+DROP TABLE e;
diff --git a/sql/core/src/test/resources/sql-tests/results/describe.sql.out b/sql/core/src/test/resources/sql-tests/results/describe.sql.out
index 70870131163e..da53ece198da 100644
--- a/sql/core/src/test/resources/sql-tests/results/describe.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/describe.sql.out
@@ -698,38 +698,6 @@ Execute DescribeRelationJsonCommand
       +- ResolvedTable V2SessionCatalog(spark_catalog), default.t, V1Table(default.t), [a#x, b#x, c#x, d#x]
 
 
--- !query
-DROP TABLE t
--- !query schema
-struct<>
--- !query output
-
-
-
--- !query
-DROP VIEW temp_v
--- !query schema
-struct<>
--- !query output
-
-
-
--- !query
-DROP VIEW temp_Data_Source_View
--- !query schema
-struct<>
--- !query output
-
-
-
--- !query
-DROP VIEW v
--- !query schema
-struct<>
--- !query output
-
-
-
 -- !query
 CREATE TABLE d (a STRING DEFAULT 'default-value', b INT DEFAULT 42) USING parquet COMMENT 'table_comment'
 -- !query schema
@@ -920,3 +888,51 @@ Location [not included in comparison]/{warehouse_dir}/e
 # Column Default Values	                    	                    
 a                   	string              	CONCAT('a\n b\n ', 'c\n d')
 b                   	int                 	42
+
+
+-- !query
+DROP VIEW temp_v
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW temp_Data_Source_View
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP VIEW v
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP TABLE t
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP TABLE d
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+DROP TABLE e
+-- !query schema
+struct<>
+-- !query output
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org