dusantism-db commented on code in PR #49445:
URL: https://github.com/apache/spark/pull/49445#discussion_r1946864387
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveCatalogs.scala:
##########
@@ -73,28 +95,49 @@ class ResolveCatalogs(val catalogManager: CatalogManager)
}
}
- private def resolveVariableName(nameParts: Seq[String]): ResolvedIdentifier
= {
- def ident: Identifier =
Identifier.of(Array(CatalogManager.SESSION_NAMESPACE), nameParts.last)
- if (nameParts.length == 1) {
- ResolvedIdentifier(FakeSystemCatalog, ident)
- } else if (nameParts.length == 2) {
- if (nameParts.head.equalsIgnoreCase(CatalogManager.SESSION_NAMESPACE)) {
- ResolvedIdentifier(FakeSystemCatalog, ident)
- } else {
- throw QueryCompilationErrors.unresolvedVariableError(
- nameParts, Seq(CatalogManager.SYSTEM_CATALOG_NAME,
CatalogManager.SESSION_NAMESPACE))
- }
- } else if (nameParts.length == 3) {
- if (nameParts(0).equalsIgnoreCase(CatalogManager.SYSTEM_CATALOG_NAME) &&
- nameParts(1).equalsIgnoreCase(CatalogManager.SESSION_NAMESPACE)) {
- ResolvedIdentifier(FakeSystemCatalog, ident)
- } else {
- throw QueryCompilationErrors.unresolvedVariableError(
- nameParts, Seq(CatalogManager.SYSTEM_CATALOG_NAME,
CatalogManager.SESSION_NAMESPACE))
- }
- } else {
+ private def resolveCreateVariableName(nameParts: Seq[String]):
ResolvedIdentifier = {
+ val resolvedIdentifier = SqlScriptingLocalVariableManager.get()
+ .filterNot(_ => AnalysisContext.get.isExecuteImmediate)
+ .getOrElse(catalogManager.tempVariableManager)
+ .resolveIdentifier(nameParts.last)
Review Comment:
`NameParts.last` is the unqualified variable name, this is the same behavior
as was present before my changes.
<img width="758" alt="image"
src="https://github.com/user-attachments/assets/c7bb7f41-db1e-453d-a95c-3336d4089f7e"
/>
--
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]