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

gurwls223 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 c00742bbb651 [SPARK-47716][SQL] Avoid view name conflict in 
SQLQueryTestSuite semantic sort test case
c00742bbb651 is described below

commit c00742bbb65129cd30193524484ce9058ee5004d
Author: Jack Chen <jack.c...@databricks.com>
AuthorDate: Fri May 31 09:54:26 2024 +0900

    [SPARK-47716][SQL] Avoid view name conflict in SQLQueryTestSuite semantic 
sort test case
    
    ### What changes were proposed in this pull request?
    In SQLQueryTestSuite, the test case "Test logic for determining whether a 
query is semantically sorted" can sometimes failure with an error
    ```
    Cannot create table or view `main`.`default`.`t1` because it already exists.
    ```
    if run concurrently with other sql test cases that also create tables with 
the same name.
    
    Fix it by putting it in a schema with a unique name.
    
    ### Why are the changes needed?
    Fix flaky test issue
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Test itself
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #45855 from jchen5/sql-sort-test.
    
    Authored-by: Jack Chen <jack.c...@databricks.com>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 .../src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
index c9cb459878cf..b031f45ddbf3 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
@@ -703,9 +703,9 @@ class SQLQueryTestSuite extends QueryTest with 
SharedSparkSession with SQLHelper
   }
 
   test("Test logic for determining whether a query is semantically sorted") {
-    withTable("t1", "t2") {
-      spark.sql("CREATE TABLE t1(a int, b int) USING parquet")
-      spark.sql("CREATE TABLE t2(a int, b int) USING parquet")
+    withTempView("t1", "t2") {
+      spark.sql("CREATE TEMP VIEW t1 AS SELECT * FROM VALUES (1, 1) AS t1(a, 
b)")
+      spark.sql("CREATE TEMP VIEW t2 AS SELECT * FROM VALUES (1, 2) AS t2(a, 
b)")
 
       val unsortedSelectQuery = "select * from t1"
       val sortedSelectQuery = "select * from t1 order by a, b"


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

Reply via email to