srielau opened a new pull request, #55523: URL: https://github.com/apache/spark/pull/55523
### What changes were proposed in this pull request? Switch the resolution engine from the legacy single-schema `resolutionSearchPath` to `sqlResolutionPathEntries` on `CatalogManager`, so that `SET PATH` actually affects how unqualified table names, function names, and variables are resolved. **CatalogManager** (`CatalogManager.scala`): - `sqlResolutionPathEntries`: ordered path entries for resolving unqualified names. When PATH is enabled and set, uses the stored session path; otherwise falls back to `defaultPathOrder` (legacy). - `sessionScopeUnqualifiedAllowed`: gates unqualified variable access when `system.session` is not on the PATH. **Relation resolution** (`RelationResolution.scala`): - `relationResolutionEntries` / `relationResolutionSteps` replace `relationResolutionSearchPath`. - `PersistentCatalogStep` carries the catalog/namespace prefix so each path entry qualifies the object name under that entry. **Function resolution** (`FunctionResolution.scala`): - `sqlResolutionPathEntriesForAnalysis` provides candidates for unqualified function names. - Procedure resolution (`resolveProcedure`) moved here from `Analyzer`. **Error context** (`CheckAnalysis.scala`): - `catalogPathForError` now consults `AnalysisContext.catalogAndNamespace` when inside a view body, so error messages report the view's defining catalog/namespace. - `UnresolvedTableOrViewSearchPathMode` enum controls DDL vs query-like error paths. - Uses `CatalogManager` constants instead of string literals. - `RelationChanges` errors now include the search path. **Variable resolution** (`VariableResolution.scala` + callers): - `allowUnqualifiedSessionTempVariableLookup` gates unqualified variable access when `system.session` is not on the PATH. **Analyzer** (`Analyzer.scala`): - `sessionConf` constructor parameter for isolated analysis (e.g. Connect). - `resolutionConf` for path-based resolution. - `AnalysisContext.resolutionPathEntries` field (initially `None`; frozen path wiring comes in follow-up PR). **Single-pass resolver**: `Resolver`, `HybridAnalyzer`, `NameScope`, `ResolverGuard` aligned with new resolution signatures. Frozen path analysis for views/SQL functions (using stored path during analysis) comes in a follow-up PR. This PR only wires the resolution engine to use the live session path. ### Why are the changes needed? `SET PATH` (merged in [SPARK-56501](https://github.com/apache/spark/pull/55364)) stores the session path but the resolvers still used the legacy single-schema path. This PR completes the wiring so PATH actually affects resolution. Part of [SPARK-54810](https://issues.apache.org/jira/browse/SPARK-54810). ### Does this PR introduce _any_ user-facing change? Yes. With `spark.sql.path.enabled = true` and `SET PATH`, unqualified table names, function names, and variable references now resolve according to the stored path order. ### How was this patch tested? CI. `ProtoToParsedPlanTestSuite` updated with analyzer isolation conf. Connect `.explain` golden files updated. `PlanResolutionSuite`, `NameScopeSuite`, `TimezoneAwareExpressionResolverSuite` updated for new constructor signatures. ### 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]
