Spark 4.1: Fix view rename target namespace#17128
Open
manuzhang wants to merge 1 commit into
Open
Conversation
nastra
reviewed
Jul 8, 2026
| .create(); | ||
|
|
||
| sql("USE %s.%s", catalogName, currentNamespace); | ||
| sql("ALTER VIEW %s.%s RENAME TO %s", sourceNamespace, viewName, renamedView); |
Contributor
There was a problem hiding this comment.
it seems a bit counter-intuitive to resolve this against the target namespace instead of resolving against the current namespace? I don't think we have other places where we would have a similar resolution strategy? Typically providing only the plain identifier should always resolve to whatever catalog/namespace is currently configured
Member
Author
There was a problem hiding this comment.
The change matches Spark's behavior.
Contributor
There was a problem hiding this comment.
can you check whether there are other places in Spark where this behavior exists or is rename the only one?
Member
Author
There was a problem hiding this comment.
Yes, it's a specific behavior in rename based on my research.
763b530 to
8f1b73e
Compare
Preserve the source view namespace when renaming a qualified view to an unqualified target name. This avoids routing the rename target through the current session namespace. Generated-by: OpenAI Codex Co-authored-by: Codex <codex@openai.com>
8f1b73e to
ad909de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Spark 4.1 V2 view rename target resolution so an unqualified rename target keeps the source view namespace instead of being resolved through the current session namespace.
Root Cause
ExtendedDataSourceV2Strategyresolved the rename target withSpark3Util.catalogAndIdentifierbefore deciding whether the target was actually unqualified. For a single-part target name, that helper fills in the current namespace, which can differ from the source view namespace.Changes
AI Disclosure