srielau commented on code in PR #55523:
URL: https://github.com/apache/spark/pull/55523#discussion_r3154730220


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/resolver/Resolver.scala:
##########
@@ -585,7 +585,9 @@ class Resolver(
           val multipartId = unresolvedRelation.multipartIdentifier
           val catalogPath = (catalogManager.currentCatalog.name() +:
             catalogManager.currentNamespace).toSeq
-          val searchPath = 
SQLConf.get.resolutionSearchPath(catalogPath).map(toSQLId)
+          val searchPath = catalogManager

Review Comment:
   Good catch, thanks. Addressed in 42531b9ec8d.
   
   I now mirror the iterative-path logic in single-pass 
`Resolver.resolveRelation`: it checks `AnalysisContext.get.catalogAndNamespace` 
first, and falls back to the live session catalog/namespace only when context 
is empty. This keeps `TABLE_OR_VIEW_NOT_FOUND` search-path context aligned 
across iterative and single-pass analysis inside view bodies.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -2078,9 +2100,9 @@ class Analyzer(
                   throw 
QueryCompilationErrors.notAScalarFunctionError(nameParts.mkString("."), f)
 
                 case FunctionType.NotFound =>
-                  val catalogPath =
-                    catalogManager.currentCatalog.name +: 
catalogManager.currentNamespace
-                  val searchPath = 
SQLConf.get.resolutionSearchPath(catalogPath.toSeq)
+                  val catalogPath = catalogPathForError
+                  val searchPath = catalogManager

Review Comment:
   Thanks, great point. Addressed in 42531b9ec8d.
   
   I exposed `FunctionResolution.sqlResolutionPathEntriesForAnalysis` to 
package scope and switched `Analyzer.LookupFunctions` NotFound error formatting 
to use that same path source. This keeps unresolved-routine error search paths 
aligned with the actual lookup candidates now, and also stays correct once 
frozen-path wiring starts populating `AnalysisContext.resolutionPathEntries`.



-- 
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]

Reply via email to