[SPARK-56611][SQL] Fix ALTER TABLE RENAME TO with catalog-qualified and table-only targets#55547
Open
lunar-shadow wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-56611][SQL] Fix ALTER TABLE RENAME TO with catalog-qualified and table-only targets#55547lunar-shadow wants to merge 1 commit intoapache:masterfrom
lunar-shadow wants to merge 1 commit intoapache:masterfrom
Conversation
669a517 to
8163d49
Compare
…nd table-only targets
8163d49 to
cf3a248
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.
What changes were proposed in this pull request?
This fixes
ALTER TABLE ... RENAME TOin V2 catalogs for two cases that weren't handled correctly:Changes:
Why are the changes needed?
Right now, rename behaves incorrectly in a few scenarios.
For example:
fails because
asIdentifiertreats everything except the last part as the namespace. That means the catalog name (testcat) incorrectly ends up inside the namespace:instead of:
Similarly:
creates an identifier with an empty namespace, instead of inheriting
nsfrom the source table.Steps to reproduce:
This fails with a namespace resolution error due to the catalog being treated as part of the namespace.
Does this PR introduce any user-facing change?
Yes.
RENAME TO t2) now correctly keeps the original namespaceHow was this patch tested?
Added tests in
DataSourceV2SQLSuitecovering catalog-qualified renames, table-only renames, and cross-namespace renames.Was this patch authored or co-authored using generative AI tooling?
No