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

   ### What changes were proposed in this pull request?
   
   This PR changes the default of `spark.sql.legacy.persistentCatalogFirst` 
from `false` to `true`.
   
   With the default, a partially qualified two-part name such as 
`builtin.func()` or `session.func()` tries the current catalog first, then the 
virtual `system` catalog (`system.builtin` / `system.session`). Setting the 
config to `false` restores the previous order, where `system` is tried first.
   
   The changes are:
   - `SQLConf`: default of `spark.sql.legacy.persistentCatalogFirst` is `true`; 
the description is updated to match.
   - `ResolverGuard`: the single-pass resolver no longer reports this config as 
an unsupported configuration, so queries are not routed to the fixed-point 
analyzer because of it.
   - Docs: `sql-ref-identifier.md` and `sql-ref-name-resolution.md` describe 
the new default; `sql-migration-guide.md` has a new entry in the 4.4 to 5.0 
section, and the 4.2 entry is clarified as applying to Spark 4.2 through 4.4.
   - Tests: tests that asserted the old default are updated. Tests that set the 
config explicitly are unchanged, and the single-pass guard test now checks that 
the config does not make a plan unsupported, for both values.
   
   ### Why are the changes needed?
   
   With the system-first order, a persistent schema named `builtin` or 
`session` in the current catalog is not reached by its two-part name whenever 
the system catalog has an object of the same name. The current-catalog-first 
order resolves two-part names against the current catalog first, which is how 
they are interpreted relative to the session. Databricks Runtime already 
defaults this config to `true`, so OSS and Runtime then agree.
   
   JIRA: https://issues.apache.org/jira/browse/SPARK-61813
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. A two-part reference such as `builtin.x` or `session.x` that matches an 
object in both the current catalog and the system namespace now resolves to the 
current catalog's object. Previously it resolved to the system object. Users 
who depend on the previous behavior can set 
`spark.sql.legacy.persistentCatalogFirst` to `false`. The migration guide 
describes this.
   
   ### How was this patch tested?
   
   Unit tests run locally with sbt:
   - `FunctionQualificationSuite`, `SetPathSuite`, 
`RelationQualificationSuite`, `JsonArraySuite`, `JsonValueSuite`, 
`ResolverGuardSuite`, `AlwaysPersistedConfigsSuite`, 
`AlterViewSchemaBindingSuite`: 386 passed, 0 failed.
   - `SQLQueryTestSuite`: 806 passed, 0 failed, 73 ignored; no golden files 
changed.
   - Scalastyle on `sql/catalyst` and `sql/core` (main and test) passed.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Cursor Agent
   


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