cloud-fan commented on code in PR #44603:
URL: https://github.com/apache/spark/pull/44603#discussion_r1442515458


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala:
##########
@@ -153,6 +158,36 @@ abstract class SQLViewSuite extends QueryTest with 
SQLTestUtils {
     }
   }
 
+
+  test("CREATE VIEW IF NOT EXISTS never throws TABLE_OR_VIEW_ALREADY_EXISTS") {
+    // Concurrently create a view with the same name, so that some of the 
queries may all
+    // get that the view does not exist and try to create it. But with IF NOT 
EXISTS, the
+    // queries should not fail.
+    import ExecutionContext.Implicits.global
+    val concurrency = 10
+    val tableName = "table_name"
+    val viewName = "view_name"
+    withTable(tableName) {
+      sql(s"CREATE TABLE $tableName (id int) USING parquet")
+      withView("view_name") {
+        val futures = (0 to concurrency).map { _ =>

Review Comment:
   the fix is trivial, we don't need to commit this fragile and heavy test. You 
can just run it off line and verify that the fix works.



##########
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala:
##########
@@ -153,6 +158,36 @@ abstract class SQLViewSuite extends QueryTest with 
SQLTestUtils {
     }
   }
 
+
+  test("CREATE VIEW IF NOT EXISTS never throws TABLE_OR_VIEW_ALREADY_EXISTS") {
+    // Concurrently create a view with the same name, so that some of the 
queries may all
+    // get that the view does not exist and try to create it. But with IF NOT 
EXISTS, the
+    // queries should not fail.
+    import ExecutionContext.Implicits.global
+    val concurrency = 10
+    val tableName = "table_name"
+    val viewName = "view_name"
+    withTable(tableName) {
+      sql(s"CREATE TABLE $tableName (id int) USING parquet")
+      withView("view_name") {
+        val futures = (0 to concurrency).map { _ =>

Review Comment:
   the fix is trivial, we don't need to commit this fragile and heavy test. You 
can just run it offline and verify that the fix works.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to