cloud-fan commented on code in PR #38776:
URL: https://github.com/apache/spark/pull/38776#discussion_r1044240476
##########
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
+ def setNameParts(newNameParts: Option[Seq[String]]): OuterReference = {
Review Comment:
This is a bit tricky. Maybe we should invoke
`WrapLateralColumnAliasReference` in `ResolveOuterReferences`, so that we don't
need to re-resolve outer references and introduce this hack.
--
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]