dongjoon-hyun commented on a change in pull request #26752: [SPARK-30112][SQL] 
Allow insert overwrite same table if using dynamic partition overwrite
URL: https://github.com/apache/spark/pull/26752#discussion_r354624321
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
 ##########
 @@ -270,6 +270,44 @@ class InsertSuite extends DataSourceTest with 
SharedSparkSession {
       "INSERT OVERWRITE to a table while querying it should not be allowed.")
   }
 
+  test("it is allowed to write to a table while querying it for dynamic 
partition overwrite.") {
+    Seq(PartitionOverwriteMode.DYNAMIC.toString,
+        PartitionOverwriteMode.STATIC.toString).foreach { usedMode =>
+      withSQLConf(SQLConf.PARTITION_OVERWRITE_MODE.key -> usedMode) {
+        withTable("insertTable") {
+          sql(
+            """
+              |CREATE TABLE insertTable(i int, part1 int, part2 int) USING 
PARQUET
+              |PARTITIONED BY (part1, part2)
+           """.stripMargin)
+
+          sql("INSERT INTO TABLE insertTable PARTITION(part1=1, part2=1) 
SELECT 1")
+          checkAnswer(spark.table("insertTable"), Row(1, 1, 1))
 
 Review comment:
   Shall we have a test table with multiple partitions with data?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to