Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18714#discussion_r132227444
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/InsertIntoHadoopFsRelationCommand.scala
 ---
    @@ -92,20 +92,29 @@ case class InsertIntoHadoopFsRelationCommand(
         }
     
         val pathExists = fs.exists(qualifiedOutputPath)
    -    // If we are appending data to an existing dir.
    -    val isAppend = pathExists && (mode == SaveMode.Append)
    +
    +    // This config only makes sense when we are overwriting a partitioned 
dataset with dynamic
    +    // partition columns.
    +    val runtimePartitionOverwrite = 
sparkSession.sessionState.conf.runtimePartitionOverwrite &&
    +      mode == SaveMode.Overwrite && staticPartitions.size < 
partitionColumns.length
     
         val committer = FileCommitProtocol.instantiate(
           sparkSession.sessionState.conf.fileCommitProtocolClass,
           jobId = java.util.UUID.randomUUID().toString,
    -      outputPath = outputPath.toString)
    +      outputPath = outputPath.toString,
    +      // If there is no matching partitions, overwrite is same as append, 
so here we only enable
    +      // runtime partition overwrite when there are matching partitions.
    +      runtimeOverwritePartition = runtimePartitionOverwrite && 
matchingPartitions.nonEmpty)
    --- End diff --
    
    `matchingPartitions.nonEmpty` needs to be removed too. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to