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

    https://github.com/apache/spark/pull/13701#discussion_r73296603
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileSourceStrategy.scala
 ---
    @@ -85,8 +85,15 @@ private[sql] object FileSourceStrategy extends Strategy 
with Logging {
             
ExpressionSet(normalizedFilters.filter(_.references.subsetOf(partitionSet)))
           logInfo(s"Pruning directories with: 
${partitionKeyFilters.mkString(",")}")
     
    -      val dataColumns =
    -        l.resolve(fsRelation.dataSchema, 
fsRelation.sparkSession.sessionState.analyzer.resolver)
    +      val dataColumns = l.resolve(fsRelation.dataSchema,
    +        fsRelation.sparkSession.sessionState.analyzer.resolver).map { c =>
    +          fsRelation.dataSchema.find(_.name == c.name).map { f =>
    +            c match {
    +              case a: AttributeReference => a.withMetadata(f.metadata)
    +              case _ => c
    +            }
    +          }.getOrElse(c)
    +        }
    --- End diff --
    
    When I add a regression test, I find that this change is not needed. Not 
sure which recent commit helps keeping metadata after resolving. I will add the 
regression test still.


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