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

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/SQLHadoopMapReduceCommitProtocol.scala
 ##########
 @@ -63,7 +70,29 @@ class SQLHadoopMapReduceCommitProtocol(
         committer = ctor.newInstance()
       }
     }
+    totalPartitions = new AtomicInteger(0)
     logInfo(s"Using output committer class 
${committer.getClass.getCanonicalName}")
     committer
   }
+
+  override def newTaskTempFile(
+      taskContext: TaskAttemptContext, dir: Option[String], ext: String): 
String = {
+    val path = super.newTaskTempFile(taskContext, dir, ext)
+    totalPartitions.incrementAndGet()
+    if (dynamicPartitionOverwrite) {
+      if (totalPartitions.get > maxDynamicPartitions) {
 
 Review comment:
   Thank you for point it. The descriptions are both from official 
documentations, but I prefer the [second 
one](https://cwiki.apache.org/confluence/display/Hive/Tutorial#Tutorial-Dynamic-PartitionInsert).
 Actually, there is no restriction for life-time of the data source in Hive, 
unless it stored into Hive Metastore. But these parameters 
hive.exec.max.dynamic.partitions.* only take effect in Hive Client. So they are 
for per DML.

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