cloud-fan commented on code in PR #39870:
URL: https://github.com/apache/spark/pull/39870#discussion_r1098632864
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/LogicalRelation.scala:
##########
@@ -68,23 +68,36 @@ case class LogicalRelation(
s"[${truncatedString(output, ",", maxFields)}] $relation"
}
- override lazy val metadataOutput: Seq[AttributeReference] = relation match {
- case relation: HadoopFsRelation =>
- val resolve = conf.resolver
- val outputNames = outputSet.map(_.name)
- def isOutputColumn(col: AttributeReference): Boolean = {
- outputNames.exists(name => resolve(col.name, name))
+ override lazy val metadataOutput: Seq[AttributeReference] = {
+ // If `metadataColFromOutput` is not empty that means `AddMetadataColumns`
merged
+ // metadata output into output. We should still return an available
metadata output
+ // so that the rule `ResolveReferences` can resolve metadata column
correctly.
+ val metadataColFromOutput = output.filter(_.isMetadataCol)
Review Comment:
ditto, move it under `case relation: HadoopFsRelation =>`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]