Revert "[SPARK-52576][SDP] Drop/recreate on full refresh and MV update" #51497
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.
This reverts commit 8b43757.
What changes were proposed in this pull request?
Reverts SPARK-52576. I.e. truncates + alters instead of drop + recreate, for materialized views and full refreshes.
Why are the changes needed?
Some pipeline runs result in wiping out and replacing all the data for a table:
Prior to SPARK-52576, this "wipe out and replace" was implemented by:
However, we discovered that this didn't work on Hive. So we moved to drop + recreate, which did work on Hive. However, compared to truncate + alter, drop + recreate has some undesirable effects. E.g. it interrupts readers of the table and wipes away things like ACLs.
This Hive behavior was fixed here: #51007.
So now we can switch back to truncate + alter.
Does this PR introduce any user-facing change?
Yes, described above
How was this patch tested?
Existing tests
Was this patch authored or co-authored using generative AI tooling?