Commit 512099b
[SPARK-54760][SQL] DelegatingCatalogExtension as session catalog supports both V1 and V2 functions
### What changes were proposed in this pull request?
This PR fixes a bug that occurs when the user uses a custom `DelegatingCatalogExtension` as the session catalog, Spark can not load the v2 function properly provided by the catalog. A typical use case is Iceberg's `SparkSessionCatalog`
```
$ spark-sql \
--conf spark.sql.catalog.spark_catalog=org.apache.iceberg.spark.SparkSessionCatalog \
...
```
```
spark-sql (default)> SELECT spark_catalog.system.iceberg_version();
[ROUTINE_NOT_FOUND] The routine `system`.`iceberg_version` cannot be found. Verify the spelling and correctness of the schema and catalog.
If you did not qualify the name with a schema and catalog, verify the current_schema() output, or qualify the name with the correct schema and catalog.
To tolerate the error on drop use DROP ... IF EXISTS. SQLSTATE: 42883; line 1 pos 7
```
### Why are the changes needed?
Fix bug.
### Does this PR introduce _any_ user-facing change?
Yes, it fixes a bug.
### How was this patch tested?
Add new UT. Also manually tested with Iceberg.
```
spark-sql (default)> SELECT spark_catalog.system.iceberg_version();
1.10.0
Time taken: 1.715 seconds, Fetched 1 row(s)
```
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #53531 from pan3793/SPARK-54760.
Authored-by: Cheng Pan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>1 parent db36f74 commit 512099b
File tree
10 files changed
+197
-126
lines changed- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis
- core/src/test
- resources/sql-tests
- analyzer-results
- results
- scala/org/apache/spark/sql/connector
10 files changed
+197
-126
lines changedLines changed: 12 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
37 | | - | |
| 34 | + | |
| 35 | + | |
38 | 36 | | |
39 | 37 | | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
275 | | - | |
276 | | - | |
| 278 | + | |
277 | 279 | | |
278 | 280 | | |
279 | | - | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
972 | 972 | | |
973 | 973 | | |
974 | 974 | | |
975 | | - | |
976 | | - | |
| 975 | + | |
| 976 | + | |
977 | 977 | | |
978 | | - | |
979 | | - | |
| 978 | + | |
| 979 | + | |
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
972 | 972 | | |
973 | 973 | | |
974 | 974 | | |
975 | | - | |
976 | | - | |
| 975 | + | |
| 976 | + | |
977 | 977 | | |
978 | | - | |
979 | | - | |
| 978 | + | |
| 979 | + | |
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1112 | 1112 | | |
1113 | 1113 | | |
1114 | 1114 | | |
1115 | | - | |
1116 | | - | |
| 1115 | + | |
| 1116 | + | |
1117 | 1117 | | |
1118 | | - | |
1119 | | - | |
| 1118 | + | |
| 1119 | + | |
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1112 | 1112 | | |
1113 | 1113 | | |
1114 | 1114 | | |
1115 | | - | |
1116 | | - | |
| 1115 | + | |
| 1116 | + | |
1117 | 1117 | | |
1118 | | - | |
1119 | | - | |
| 1118 | + | |
| 1119 | + | |
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
171 | 175 | | |
172 | 176 | | |
173 | 177 | | |
| |||
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
181 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
182 | 188 | | |
183 | 189 | | |
184 | 190 | | |
| |||
Lines changed: 91 additions & 91 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
702 | 702 | | |
703 | 703 | | |
704 | 704 | | |
| 705 | + | |
705 | 706 | | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
710 | 711 | | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
715 | 715 | | |
| 716 | + | |
716 | 717 | | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
721 | 722 | | |
722 | | - | |
723 | | - | |
724 | | - | |
| 723 | + | |
| 724 | + | |
725 | 725 | | |
| 726 | + | |
726 | 727 | | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
731 | 732 | | |
732 | | - | |
733 | | - | |
734 | | - | |
| 733 | + | |
| 734 | + | |
735 | 735 | | |
| 736 | + | |
736 | 737 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
745 | 742 | | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
| 743 | + | |
| 744 | + | |
750 | 745 | | |
751 | 746 | | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
756 | 750 | | |
| 751 | + | |
757 | 752 | | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
764 | 758 | | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
770 | 765 | | |
771 | | - | |
772 | | - | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
773 | 771 | | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
| 772 | + | |
| 773 | + | |
778 | 774 | | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | | - | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
785 | 778 | | |
786 | 779 | | |
787 | | - | |
788 | | - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
789 | 786 | | |
790 | 787 | | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
795 | 791 | | |
796 | | - | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
797 | 796 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
| 797 | + | |
812 | 798 | | |
813 | | - | |
814 | | - | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
815 | 811 | | |
| 812 | + | |
816 | 813 | | |
817 | | - | |
| 814 | + | |
| 815 | + | |
818 | 816 | | |
819 | 817 | | |
820 | | - | |
821 | | - | |
822 | | - | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
823 | 824 | | |
824 | | - | |
825 | | - | |
826 | | - | |
| 825 | + | |
| 826 | + | |
827 | 827 | | |
828 | 828 | | |
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
0 commit comments