srielau opened a new pull request, #55521:
URL: https://github.com/apache/spark/pull/55521

   ### What changes were proposed in this pull request?
   
   Make `TABLE_OR_VIEW_NOT_FOUND` and `UNRESOLVED_ROUTINE` error messages 
context-aware when fired inside a view body:
   
   - `catalogPathForError` now consults `AnalysisContext.catalogAndNamespace` 
when resolving inside a view body, so error messages report the view's defining 
catalog/namespace rather than the caller's current schema.
   - Use `CatalogManager.SYSTEM_CATALOG_NAME` / `SESSION_NAMESPACE` constants 
instead of string literals in `ddlSearchPathForError` and 
`tempViewOnlySearchPathForError`.
   - Add `searchPath` to `RelationChanges` error (was missing, producing "not 
available").
   
   ### Why are the changes needed?
   
   When an unresolved relation error fires inside a view body, the current 
error message shows the caller's current schema, not the view's defining 
schema. This is confusing -- the user sees a search path that doesn't match 
where the view was actually trying to resolve.
   
   These are prerequisite cleanups for the SQL PATH resolution wiring 
([SPARK-54810](https://issues.apache.org/jira/browse/SPARK-54810)).
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Error messages for `TABLE_OR_VIEW_NOT_FOUND` inside view bodies now 
show the view's defining catalog/namespace instead of the caller's current 
schema. `RelationChanges` errors now include the search path.
   
   ### How was this patch tested?
   
   CI (1 file, 15-line change to `CheckAnalysis.scala`).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 4.6


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