This is an automated email from the ASF dual-hosted git repository. wenchen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new cedef63faf14 [SPARK-45807][SQL] Return View after calling replaceView(..) cedef63faf14 is described below commit cedef63faf14ce41ea9f4540faa4a1c18cf7cea8 Author: Eduard Tudenhoefner <etudenhoef...@gmail.com> AuthorDate: Fri Feb 2 10:35:56 2024 +0800 [SPARK-45807][SQL] Return View after calling replaceView(..) ### What changes were proposed in this pull request? Follow-up API improvements based on from https://github.com/apache/spark/pull/43677 ### Why are the changes needed? Required for DataSourceV2 view support. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? N/A ### Was this patch authored or co-authored using generative AI tooling? N/A Closes #44970 from nastra/SPARK-45807-return-type. Authored-by: Eduard Tudenhoefner <etudenhoef...@gmail.com> Signed-off-by: Wenchen Fan <wenc...@databricks.com> --- .../java/org/apache/spark/sql/connector/catalog/ViewCatalog.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/ViewCatalog.java b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/ViewCatalog.java index 933289cab40b..abe5fb3148d0 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/ViewCatalog.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/ViewCatalog.java @@ -115,7 +115,7 @@ public interface ViewCatalog extends CatalogPlugin { * Create a view in the catalog. * * @param viewInfo the info class holding all view information - * @return the view created + * @return the created view. This can be null if getting the metadata for the view is expensive * @throws ViewAlreadyExistsException If a view or table already exists for the identifier * @throws NoSuchNamespaceException If the identifier namespace does not exist (optional) */ @@ -129,10 +129,12 @@ public interface ViewCatalog extends CatalogPlugin { * * @param viewInfo the info class holding all view information * @param orCreate create the view if it doesn't exist + * @return the created/replaced view. This can be null if getting the metadata + * for the view is expensive * @throws NoSuchViewException If the view doesn't exist or is a table * @throws NoSuchNamespaceException If the identifier namespace does not exist (optional) */ - default void replaceView( + default View replaceView( ViewInfo viewInfo, boolean orCreate) throws NoSuchViewException, NoSuchNamespaceException { @@ -143,7 +145,7 @@ public interface ViewCatalog extends CatalogPlugin { } try { - createView(viewInfo); + return createView(viewInfo); } catch (ViewAlreadyExistsException e) { throw new RuntimeException("Race condition when creating/replacing view", e); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org