cloud-fan commented on code in PR #40300: URL: https://github.com/apache/spark/pull/40300#discussion_r1127321842
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LogicalPlan.scala: ########## @@ -42,6 +42,24 @@ abstract class LogicalPlan */ def metadataOutput: Seq[Attribute] = children.flatMap(_.metadataOutput) + /** + * Finds a metadata attribute of this node by its logical name. This search will work even if the + * metadata attribute was renamed because of a conflicting name in the data schema. + */ + def getMetadataAttributeByName(name: String): Attribute = { + // NOTE: An already-referenced column might appear in `output` instead of `metadataOutput`. Review Comment: metadata col may appear in `output`, but always appear in `metadataOutput`. I think `outputMetadataAttributes.resolve(nameParts, resolver)` should do the work. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org