anchovYu commented on code in PR #44603:
URL: https://github.com/apache/spark/pull/44603#discussion_r1442533613
##########
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:
Yes I have verified that without the fix this test failed.
--
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]