Commit e17ff64
[SPARK-52417][SQL] Simplify Table properties handling in View Schema Evolution Mode
### What changes were proposed in this pull request?
When a View is created, ex CREATE VIEW v (a1 INT, a2 STRING) AS select c1, c2, it needs to save both set of columns (user-specified view schema and query output).
1. User-specified View schema are saved as View Schema (a1 INT, b2 STRING).
2. View query output is saved as Table property w/index (c1, 0) (c2, 1)
In the new Schema Evolution mode, we never allow user-specified view schema, so view schema == view query output schema. Every time we detect the output view schema changes, we sync the view's schema with view query schema, keeping the invariant.
So we can simplify the logic for View in Schema Evolution mode to not update the Table Properties, and instead rely on the View Schema all the time.
### Why are the changes needed?
View Schema Evolution is a useful mode. However, it requires a lot of permissions on the user querying the view, because that user needs to update the View definition. It will simplify auth if we do not have to update table properties too, and reduce the update to only the schema.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Existing unit test
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #51107 from szehon-ho/SPARK-524167.
Authored-by: Szehon Ho <szehon.apache@gmail.com>
Signed-off-by: Gengliang Wang <gengliang@apache.org>1 parent 722d02c commit e17ff64
File tree
4 files changed
+46
-18
lines changed- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog
- core/src
- main/scala/org/apache/spark/sql/execution
- command
- datasources
- test/scala/org/apache/spark/sql/execution
4 files changed
+46
-18
lines changedLines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
633 | | - | |
634 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
635 | 641 | | |
636 | 642 | | |
637 | 643 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
589 | 597 | | |
590 | 598 | | |
591 | 599 | | |
592 | 600 | | |
593 | 601 | | |
594 | 602 | | |
595 | | - | |
| 603 | + | |
596 | 604 | | |
597 | 605 | | |
598 | 606 | | |
| |||
Lines changed: 1 addition & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
705 | 704 | | |
706 | 705 | | |
707 | 706 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | 707 | | |
719 | 708 | | |
720 | 709 | | |
| |||
727 | 716 | | |
728 | 717 | | |
729 | 718 | | |
730 | | - | |
731 | | - | |
732 | | - | |
| 719 | + | |
733 | 720 | | |
734 | 721 | | |
735 | 722 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
827 | 828 | | |
828 | 829 | | |
829 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
830 | 857 | | |
831 | 858 | | |
832 | 859 | | |
| |||
0 commit comments