itskals commented on a change in pull request #25840: [SPARK-29166][SQL] Add 
parameters to limit the number of dynamic partitions for data source table
URL: https://github.com/apache/spark/pull/25840#discussion_r326006606
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
 ##########
 @@ -654,6 +654,30 @@ class InsertSuite extends DataSourceTest with 
SharedSparkSession {
     }
   }
 
+  test("dynamic partition overwrite with limitation") {
+    withSQLConf(
+      SQLConf.PARTITION_OVERWRITE_MODE.key -> 
PartitionOverwriteMode.DYNAMIC.toString,
+      SQLConf.MAX_DYNAMIC_PARTITIONS.key -> "3") {
+      withTable("t") {
+        sql(
+          """
+            |create table t(i int, part1 int, part2 int) using parquet
+            |partitioned by (part1, part2)
+          """.stripMargin)
+
+        sql("insert into t partition(part1=1, part2=1) select 1")
+        checkAnswer(spark.table("t"), Row(1, 1, 1))
+
+        val e = intercept[SparkException] {
+          sql("insert overwrite table t partition(part1=2, part2)" +
+            " select 2, explode(array(2, 3, 4, 5))")
 
 Review comment:
   if this sql was split into multiple individual inserts, will the exception 
be generated. ? I guess not, as per the code.  My thoughts are echoing the 
[comment](https://github.com/apache/spark/pull/25840/files#r325981618). 
However, i feel the expectation should have been an exception be raised when 
more than 3 partitions are created, whenever it happens.
   

----------------------------------------------------------------
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