xunxunmimi5577 commented on code in PR #48554:
URL: https://github.com/apache/spark/pull/48554#discussion_r1815003306
##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -2731,6 +2731,27 @@ class InsertSuite extends DataSourceTest with
SharedSparkSession {
}
}
}
+
+ test("spark 50005: Can't overwrite a table that is also being read from") {
+ val tableName1 = "t1"
+ val tableName2 = "t2"
+ withTable(tableName1, tableName2) {
+ sql(s"CREATE TABLE $tableName1 (a STRING, b INT) USING parquet")
+ sql(s"CREATE TABLE $tableName2 (a STRING, b INT) USING parquet")
+ checkError(
+ exception = intercept[AnalysisException] {
+ sql(
+ s"""
+ |INSERT OVERWRITE TABLE $tableName1
+ |SELECT * FROM $tableName2 tb
+ |WHERE NOT EXISTS(SELECT ta.b FROM $tableName1 ta WHERE tb.b =
ta.b)
Review Comment:
OK.That should work too.
--
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]