cloud-fan commented on code in PR #59226:
URL: https://github.com/apache/spark/pull/59226#discussion_r4281392358
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -182,6 +182,13 @@ case class AnalysisContext(
// than one variable is read via an IDENTIFIER clause.
referredTempVariableNamesUnderIdentifier: mutable.Set[Seq[String]] =
mutable.LinkedHashSet.empty,
+ // Whether a SQL function expanded during this analysis shares the
accumulator above with the
Review Comment:
**Nit (P3):** This makes CREATE FUNCTION a consumer of
`referredTempVariableNamesUnderIdentifier`. A persistent function rejects the
recorded names, or discards them under
`spark.sql.legacy.allowSessionVariableInPersistedView`, and a temporary one
stores them in `referredTempVariableNames`. The two comments that enumerate the
set's consumers still list only the view paths, though:
- The accumulator doc directly above names only a temporary view, temporary
ALTER VIEW, or CACHE TABLE AS SELECT as storing the names, and a persisted
CREATE/ALTER VIEW as rejecting them.
- `ResolveIdentifierClause.scala:116-118` says "The recorded set is consumed
by temporary-view create/ALTER and CACHE TABLE AS SELECT (stored as metadata)
and by persisted CREATE/ALTER VIEW (rejected -- unless the legacy flag makes
the persisted paths discard it instead)".
This new field doc hints at function creation, but the
`ResolveIdentifierClause` list is what someone would read before changing what
gets recorded, e.g. the command-name exclusion that comment justifies, or how
the legacy flag discards the set. Could you add SQL function creation to both
lists? Persistent functions reject the set (or discard it under the legacy
flag), and temporary functions store it as informational metadata. This is
comment-only; nothing changes at runtime.
**Verification:**
- **Inspection:** The comments describing who consumes the
IDENTIFIER-variable accumulator, in the analysis context and in the
IDENTIFIER-clause recording rule, name SQL function creation alongside the view
and CACHE TABLE AS SELECT consumers, and the diff touches only comments.
--
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]