[SPARK-33786][SQL][3.0] The storage level for a cache should be respected when a table name is altered. #30793
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 is a back port of #30774.
This PR proposes to retain the cache's storage level when a table name is altered by
ALTER TABLE ... RENAME TO ...
.Why are the changes needed?
Currently, when a table name is altered, the table's cache is refreshed (if exists), but the storage level is not retained. For example:
oldStorageLevel
will beStorageLevel(memory, deserialized, 1 replicas)
whereasnewStorageLevel
will beStorageLevel(disk, memory, deserialized, 1 replicas)
, which is the default storage level.Does this PR introduce any user-facing change?
Yes, now the storage level for the cache will be retained.
How was this patch tested?
Added a unit test.