Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18386#discussion_r123432835
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormatWriter.scala
 ---
    @@ -111,9 +111,18 @@ object FileFormatWriter extends Logging {
         job.setOutputValueClass(classOf[InternalRow])
         FileOutputFormat.setOutputPath(job, new Path(outputSpec.outputPath))
     
    -    val allColumns = queryExecution.logical.output
    +    val allColumns = queryExecution.executedPlan.output
    +    // Get the actual partition columns as attributes after matching them 
by name with
    +    // the given columns names.
    +    val partitionColumns = partitionColumnNames.map { col =>
    +      val nameEquality = sparkSession.sessionState.conf.resolver
    +      allColumns.find(f => nameEquality(f.name, col)).getOrElse {
    +        throw new RuntimeException(
    +          s"Partition column $col not found in schema 
${queryExecution.executedPlan.schema}")
    +      }
    +    }
         val partitionSet = AttributeSet(partitionColumns)
    -    val dataColumns = 
queryExecution.logical.output.filterNot(partitionSet.contains)
    +    val dataColumns = 
queryExecution.executedPlan.output.filterNot(partitionSet.contains)
    --- End diff --
    
    nit: use `allColumns` here


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to