You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "srielau (via GitHub)" <gi...@apache.org> on 2026/05/27 23:00:02 UTC
[PR] [SPARK-57109] SYSTEM.SESSION shoudl not be part of SYSTEM_PATH [spark]
srielau opened a new pull request, #56161:
URL: https://github.com/apache/spark/pull/56161
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57109] SYSTEM.SESSION should not be part of SYSTEM_PATH [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #56161:
URL: https://github.com/apache/spark/pull/56161#discussion_r3326303515
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,59 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract. The default `sessionFunctionResolutionOrder` is "second" (builtin first, then
+ // session, then catalog entries); ordering tests for the other modes live below.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
+ val entries = pathEntries(currentPath())
+ assert(entries === Seq("system.builtin", "system.session", "spark_catalog.default"),
+ s"DEFAULT_PATH should expand to system.builtin, system.session, and the current " +
+ s"schema; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = SYSTEM_PATH, CURRENT_SCHEMA composes cleanly") {
+ // SPARK-57109: SYSTEM_PATH plus CURRENT_SCHEMA is the canonical "system functions plus my
+ // working schema" path; verify the expansion is exactly those two entries in order.
+ withPathEnabled {
+ sql("USE spark_catalog.default")
+ sql("SET PATH = SYSTEM_PATH, CURRENT_SCHEMA")
+ val entries = pathEntries(currentPath())
+ assert(entries === Seq("system.builtin", "spark_catalog.default"),
+ s"SYSTEM_PATH, CURRENT_SCHEMA should expand to [system.builtin, " +
+ s"current schema]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = SYSTEM_PATH, system.session is the documented migration form") {
+ // SPARK-57109: callers who relied on the old SYSTEM_PATH expansion (system.builtin +
+ // system.session) can name system.session explicitly. Pre-PR this would have raised
+ // DUPLICATE_SQL_PATH_ENTRY because SYSTEM_PATH already carried system.session; post-PR it
+ // is legal and expands to [system.builtin, system.session]. Pinning this here locks in
+ // the migration contract and guards against a future re-expansion of SYSTEM_PATH that
+ // would silently turn this back into a duplicate.
Review Comment:
Once this merges, "Pre-PR"/"post-PR" lose their referent. Suggest stating the current invariant and the regression this guards against instead:
```suggestion
// SPARK-57109: callers who relied on the old SYSTEM_PATH expansion (system.builtin +
// system.session) can name system.session explicitly. Because SYSTEM_PATH now expands to
// only system.builtin, listing system.session alongside it is legal and yields
// [system.builtin, system.session]. If SYSTEM_PATH ever re-expanded to carry system.session
// again, this entry would collide and raise DUPLICATE_SQL_PATH_ENTRY -- which is the
// regression this test guards against.
```
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,59 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract. The default `sessionFunctionResolutionOrder` is "second" (builtin first, then
+ // session, then catalog entries); ordering tests for the other modes live below.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
Review Comment:
This test asserts the path ends in `spark_catalog.default`, but unlike the `SYSTEM_PATH, CURRENT_SCHEMA` test just below it never runs `USE` to establish the current schema — it passes only because the preceding test happens to leave the namespace at default (there's no `beforeEach` reset). Pinning it makes the test self-contained and consistent with its neighbor:
```suggestion
sql("USE spark_catalog.default")
sql("SET PATH = DEFAULT_PATH")
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57109] SYSTEM.SESSION should not be part of SYSTEM_PATH [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #56161:
URL: https://github.com/apache/spark/pull/56161#issuecomment-4585318140
thanks, merging to master/4.x/4.2!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57109][SQL] SYSTEM.SESSION should not be part of SYSTEM_PATH [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #56161:
URL: https://github.com/apache/spark/pull/56161#discussion_r3315830026
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,42 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
+ val entries = pathEntries(currentPath())
+ assert(entries.toSet === Set("system.builtin", "system.session", "spark_catalog.default"),
+ s"DEFAULT_PATH should expand to system.builtin, system.session, and the current " +
+ s"schema; got: $entries")
Review Comment:
The comment above (line 291) says "pin the spark-built-in default **ordering**", and the test name says `system.builtin, system.session, and the current schema` (an ordered list). But `entries.toSet === Set(...)` only checks set membership -- a future change that reorders the default path (e.g. swapping the session/builtin slots) would not fail this test. The other two new tests in this block use ordered `Seq` equality. Suggest tightening so the assertion matches the stated intent:
```suggestion
assert(entries === Seq("system.builtin", "system.session", "spark_catalog.default"),
s"DEFAULT_PATH should expand to system.builtin, system.session, and the current " +
s"schema; got: $entries")
```
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala:
##########
@@ -128,8 +128,9 @@ class SessionCatalog(
* applied).
*
* When unset (e.g. standalone [[SessionCatalog]] in tests), kinds derive from
- * [[SQLConf.systemPathOrder]] -- the seeded default path -- without assuming other legacy
- * resolution-order conf beyond seeding `defaultPathOrder`.
+ * [[SQLConf.defaultPathOrder]] with no catalog entries -- equivalent to the system slots of
Review Comment:
Minor wording: `system slots` is a coined term not used elsewhere in this file. Reading it requires inferring that "slots" means the `system.*` entries. Consider:
```suggestion
* [[SQLConf.defaultPathOrder]] with no catalog entries -- equivalent to the system-namespace entries of
```
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,42 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
+ val entries = pathEntries(currentPath())
+ assert(entries.toSet === Set("system.builtin", "system.session", "spark_catalog.default"),
+ s"DEFAULT_PATH should expand to system.builtin, system.session, and the current " +
+ s"schema; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = SYSTEM_PATH, CURRENT_SCHEMA composes cleanly") {
+ // SPARK-57109: SYSTEM_PATH plus CURRENT_SCHEMA is the canonical "system functions plus my
+ // working schema" path; verify the expansion is exactly those two entries in order.
+ withPathEnabled {
+ sql("USE spark_catalog.default")
+ sql("SET PATH = SYSTEM_PATH, CURRENT_SCHEMA")
+ val entries = pathEntries(currentPath())
+ assert(entries === Seq("system.builtin", "spark_catalog.default"),
+ s"SYSTEM_PATH, CURRENT_SCHEMA should expand to [system.builtin, " +
+ s"current schema]; got: $entries")
}
}
Review Comment:
Consider adding a positive test for the documented migration path `SET PATH = SYSTEM_PATH, system.session`. The PR description names this as the explicit replacement for users who relied on the old behavior; pre-PR it would have been `DUPLICATE_SQL_PATH_ENTRY`, post-PR it is legal and expands to `[system.builtin, system.session]`. Pinning it here would both lock in the migration contract and catch a future re-expansion of `SYSTEM_PATH` that would silently turn this back into a duplicate.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57109] SYSTEM.SESSION should not be part of SYSTEM_PATH [spark]
Posted by "srielau (via GitHub)" <gi...@apache.org>.
srielau commented on code in PR #56161:
URL: https://github.com/apache/spark/pull/56161#discussion_r3322662127
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,42 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
+ val entries = pathEntries(currentPath())
+ assert(entries.toSet === Set("system.builtin", "system.session", "spark_catalog.default"),
+ s"DEFAULT_PATH should expand to system.builtin, system.session, and the current " +
+ s"schema; got: $entries")
Review Comment:
Done in f81ed8b — switched the assertion to ordered `Seq` equality and expanded the comment to note this is the `"second"` (default) order; the `"first"` and `"last"` modes are pinned separately just below.
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,42 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
+ val entries = pathEntries(currentPath())
+ assert(entries.toSet === Set("system.builtin", "system.session", "spark_catalog.default"),
+ s"DEFAULT_PATH should expand to system.builtin, system.session, and the current " +
+ s"schema; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = SYSTEM_PATH, CURRENT_SCHEMA composes cleanly") {
+ // SPARK-57109: SYSTEM_PATH plus CURRENT_SCHEMA is the canonical "system functions plus my
+ // working schema" path; verify the expansion is exactly those two entries in order.
+ withPathEnabled {
+ sql("USE spark_catalog.default")
+ sql("SET PATH = SYSTEM_PATH, CURRENT_SCHEMA")
+ val entries = pathEntries(currentPath())
+ assert(entries === Seq("system.builtin", "spark_catalog.default"),
+ s"SYSTEM_PATH, CURRENT_SCHEMA should expand to [system.builtin, " +
+ s"current schema]; got: $entries")
}
}
Review Comment:
Done in f81ed8b — added `SET PATH = SYSTEM_PATH, system.session is the documented migration form`. It pins the expanded path as `[system.builtin, system.session]` and the comment calls out that pre-PR this would have raised `DUPLICATE_SQL_PATH_ENTRY`, so a future re-expansion of `SYSTEM_PATH` would fail this test.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57109] SYSTEM.SESSION should not be part of SYSTEM_PATH [spark]
Posted by "srielau (via GitHub)" <gi...@apache.org>.
srielau commented on code in PR #56161:
URL: https://github.com/apache/spark/pull/56161#discussion_r3328409353
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,59 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract. The default `sessionFunctionResolutionOrder` is "second" (builtin first, then
+ // session, then catalog entries); ordering tests for the other modes live below.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
Review Comment:
Thanks — addressed in a556680, exactly per your suggestion.
##########
sql/core/src/test/scala/org/apache/spark/sql/SetPathSuite.scala:
##########
@@ -274,14 +274,59 @@ class SetPathSuite extends SharedSparkSession {
}
}
- test("PATH enabled: SET PATH = SYSTEM_PATH includes system.builtin and system.session") {
+ test("PATH enabled: SET PATH = SYSTEM_PATH expands to system-managed namespaces") {
+ // SPARK-57109: SYSTEM_PATH expands to the system-managed namespaces under the `system`
+ // catalog. Today that is just `system.builtin`; the shortcut is reserved for future
+ // system-managed schemas.
withPathEnabled {
sql("SET PATH = SYSTEM_PATH")
val entries = pathEntries(currentPath())
- assert(entries.contains("system.builtin"),
- s"SYSTEM_PATH should include system.builtin; got: $entries")
- assert(entries.contains("system.session"),
- s"SYSTEM_PATH should include system.session; got: $entries")
+ assert(entries === Seq("system.builtin"),
+ s"SYSTEM_PATH should expand to exactly [system.builtin]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = DEFAULT_PATH includes system.builtin, system.session, " +
+ "and the current schema") {
+ // SPARK-57109: pin the spark-built-in default ordering used when `spark.sql.defaultPath`
+ // is empty, so a future change to SYSTEM_PATH cannot silently drift the DEFAULT_PATH
+ // contract. The default `sessionFunctionResolutionOrder` is "second" (builtin first, then
+ // session, then catalog entries); ordering tests for the other modes live below.
+ withPathEnabled {
+ sql("SET PATH = DEFAULT_PATH")
+ val entries = pathEntries(currentPath())
+ assert(entries === Seq("system.builtin", "system.session", "spark_catalog.default"),
+ s"DEFAULT_PATH should expand to system.builtin, system.session, and the current " +
+ s"schema; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = SYSTEM_PATH, CURRENT_SCHEMA composes cleanly") {
+ // SPARK-57109: SYSTEM_PATH plus CURRENT_SCHEMA is the canonical "system functions plus my
+ // working schema" path; verify the expansion is exactly those two entries in order.
+ withPathEnabled {
+ sql("USE spark_catalog.default")
+ sql("SET PATH = SYSTEM_PATH, CURRENT_SCHEMA")
+ val entries = pathEntries(currentPath())
+ assert(entries === Seq("system.builtin", "spark_catalog.default"),
+ s"SYSTEM_PATH, CURRENT_SCHEMA should expand to [system.builtin, " +
+ s"current schema]; got: $entries")
+ }
+ }
+
+ test("PATH enabled: SET PATH = SYSTEM_PATH, system.session is the documented migration form") {
+ // SPARK-57109: callers who relied on the old SYSTEM_PATH expansion (system.builtin +
+ // system.session) can name system.session explicitly. Pre-PR this would have raised
+ // DUPLICATE_SQL_PATH_ENTRY because SYSTEM_PATH already carried system.session; post-PR it
+ // is legal and expands to [system.builtin, system.session]. Pinning this here locks in
+ // the migration contract and guards against a future re-expansion of SYSTEM_PATH that
+ // would silently turn this back into a duplicate.
Review Comment:
Thanks — addressed in a556680, comment now states the current invariant and the regression it guards.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57109] SYSTEM.SESSION should not be part of SYSTEM_PATH [spark]
Posted by "srielau (via GitHub)" <gi...@apache.org>.
srielau commented on code in PR #56161:
URL: https://github.com/apache/spark/pull/56161#discussion_r3322663245
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala:
##########
@@ -128,8 +128,9 @@ class SessionCatalog(
* applied).
*
* When unset (e.g. standalone [[SessionCatalog]] in tests), kinds derive from
- * [[SQLConf.systemPathOrder]] -- the seeded default path -- without assuming other legacy
- * resolution-order conf beyond seeding `defaultPathOrder`.
+ * [[SQLConf.defaultPathOrder]] with no catalog entries -- equivalent to the system slots of
Review Comment:
Done in f81ed8b — applied the suggestion.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-57109] SYSTEM.SESSION should not be part of SYSTEM_PATH [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #56161: [SPARK-57109] SYSTEM.SESSION should not be part of SYSTEM_PATH
URL: https://github.com/apache/spark/pull/56161
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org