stczwd edited a comment on pull request #35549:
URL: https://github.com/apache/spark/pull/35549#issuecomment-1062790013


   Hm, I got your mind. After looking at the relevant logic, 
`customPartitionLocations` will only be used while overwriting hive static 
partition.
   Thus, we can use `listPartitions` when `partitionsTrackedByCatalog && 
staticPartitions.size < partitionColumns.length` and use `listPartitionNames` 
when `partitionsTrackedByCatalog`.
   ```
   if (partitionsTrackedByCatalog) {
         if (staticPartitions.size < partitionColumns.length) {
           matchingPartitions = 
sparkSession.sessionState.catalog.listPartitions(
             catalogTable.get.identifier, Some(staticPartitions))
           initialMatchingPartitions = matchingPartitions.map(_.spec)
           customPartitionLocations = getCustomPartitionLocations(
             fs, catalogTable.get, qualifiedOutputPath, matchingPartitions)
         } else {
               // calling listPartitionNames to find initialMatchingPartitions
         }
   }
   ```
   cc @cloud-fan @LuciferYang 


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

Reply via email to