stevomitric commented on code in PR #58606:
URL: https://github.com/apache/spark/pull/58606#discussion_r3987959061
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveIdentifierClause.scala:
##########
@@ -95,12 +117,27 @@ class ResolveIdentifierClause(earlyBatches:
Seq[RuleExecutor[LogicalPlan]#Batch]
if (referredTempVars.isDefined) {
referredTempVars.get ++=
collectTemporaryVariablesInExpressionTree(e)
}
+ if (recordUnderIdentifier) {
+ recordTemporaryVariablesUnderIdentifier(e.identifierExpr)
+ }
e.exprBuilder.apply(
IdentifierResolution.evalIdentifierExpr(e.identifierExpr),
e.otherExprs)
}
}
+ /**
+ * Records the temporary variables read by an identifier expression in the
[[AnalysisContext]].
+ * Evaluating the identifier expression is the last time these references
are visible: the
+ * placeholder is replaced by the plan or expression built from the
evaluated name, which no
+ * longer mentions them. Temporary view creation persists the recorded names
so that the
+ * variables are still resolvable when the stored view text is analyzed
again.
+ */
+ private def recordTemporaryVariablesUnderIdentifier(identifierExpr:
Expression): Unit = {
Review Comment:
Reworded to views only.
--
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]