You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gatorsmile <gi...@git.apache.org> on 2017/08/09 15:57:31 UTC

[GitHub] spark pull request #18714: [SPARK-20236][SQL] runtime partition overwrite

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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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