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

    https://github.com/apache/spark/pull/15997#discussion_r89405402
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala
 ---
    @@ -133,25 +135,25 @@ case class DataSource(
         val partitionSchema = if (partitionColumns.isEmpty && 
catalogTable.isEmpty) {
           // Try to infer partitioning, because no DataSource in the read path 
provides the partitioning
           // columns properly unless it is a Hive DataSource
    -      val resolved = tempFileCatalog.partitionSchema.map { partitionField 
=>
    +      val resolved = tempFileIndex.partitionSchema.map { partitionField =>
             val equality = sparkSession.sessionState.conf.resolver
             // SPARK-18510: try to get schema from userSpecifiedSchema, 
otherwise fallback to inferred
             userSpecifiedSchema.flatMap(_.find(f => equality(f.name, 
partitionField.name))).getOrElse(
               partitionField)
           }
           StructType(resolved)
         } else {
    -      // in streaming mode, we have already inferred and registered 
partition columns, we will
    -      // never have to materialize the lazy val below
    -      lazy val inferredPartitions = tempFileCatalog.partitionSchema
           // maintain old behavior before SPARK-18510. If userSpecifiedSchema 
is empty used inferred
           // partitioning
           if (userSpecifiedSchema.isEmpty) {
    +        val inferredPartitions = tempFileIndex.partitionSchema
    --- End diff --
    
    Still keep the `inferredPartitions` variable to document the meaning of 
`tempFileIndex.partitionSchema`.


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