cxzl25 commented on a change in pull request #29316:
URL: https://github.com/apache/spark/pull/29316#discussion_r486151446



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala
##########
@@ -402,6 +403,22 @@ case class PreprocessTableInsertion(conf: SQLConf) extends 
Rule[LogicalPlan] {
           s"including ${staticPartCols.size} partition column(s) having 
constant value(s).")
     }
 
+    val partitionsTrackedByCatalog = conf.manageFilesourcePartitions &&
+      catalogTable.isDefined &&
+      catalogTable.get.partitionColumnNames.nonEmpty &&
+      catalogTable.get.tracksPartitionsInCatalog
+    // check static partition
+    if (partitionsTrackedByCatalog &&
+      normalizedPartSpec.nonEmpty &&
+      staticPartCols.size == partColNames.size) {

Review comment:
       `staticPartCols` only has fields that specify the partition value
   `partColNames` are all partition fields
   Because it only checks the writing to the static partition
   
   ```sql
   insert ovwriter table a partition(d='1',h) select 1,''
   ```
   ```
   staticPartCols=[d]
   partColNames=[d,h]
   ```
   ```sql
   insert ovwriter table a partition(d='1',h='') select 1
   ```
   ```
   staticPartCols=[d,h]
   partColNames=[d,h]
   ```




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



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

Reply via email to