anchovYu commented on code in PR #38776: URL: https://github.com/apache/spark/pull/38776#discussion_r1046592935
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala: ########## @@ -424,8 +424,51 @@ case class OuterReference(e: NamedExpression) override def qualifier: Seq[String] = e.qualifier override def exprId: ExprId = e.exprId override def toAttribute: Attribute = e.toAttribute - override def newInstance(): NamedExpression = OuterReference(e.newInstance()) + override def newInstance(): NamedExpression = + OuterReference(e.newInstance()).setNameParts(nameParts) final override val nodePatterns: Seq[TreePattern] = Seq(OUTER_REFERENCE) + + // optional field, the original name parts of UnresolvedAttribute before it is resolved to + // OuterReference. Used in rule ResolveLateralColumnAlias to convert OuterReference back to + // LateralColumnAliasReference. + var nameParts: Option[Seq[String]] = None Review Comment: QQ: I didn't add it in the constructor of `OuterReference` due to binary compatibility. Is that concern valid? ~~Actually, what is the risk to change the constructor, but also write another `unapply` function?~~ This seems impossible without introducing a new object with another name, and still requires large portion of code change of pattern matching. -- 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]
