You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/08/02 18:36:37 UTC

[GitHub] [spark] rdblue commented on a change in pull request #25330: [SPARK-28565][SQL] DataFrameWriter saveAsTable support for V2 catalogs

rdblue commented on a change in pull request #25330: [SPARK-28565][SQL] DataFrameWriter saveAsTable support for V2 catalogs
URL: https://github.com/apache/spark/pull/25330#discussion_r310251763
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ##########
 @@ -648,8 +648,13 @@ class Analyzer(
           if catalog.isTemporaryTable(ident) =>
         u // temporary views take precedence over catalog table names
 
-      case u @ UnresolvedRelation(CatalogObjectIdentifier(Some(catalogPlugin), ident)) =>
-        loadTable(catalogPlugin, ident).map(DataSourceV2Relation.create).getOrElse(u)
+      case u @ UnresolvedRelation(CatalogObjectIdentifier(maybeCatalog, ident)) =>
+        // First try loading the table with a loadable catalog, then fallback to the session
+        // catalog if that exists
+        maybeCatalog.flatMap(loadTable(_, ident))
 
 Review comment:
   > That's the tricky thing. We need to see if we can load using the defined catalog first. If the catalog is defined, but it doesn't return a table, then we miss out on using the session catalog.
   
   I disagree.
   
   Determining which catalog is responsible for an identifier is independent of the catalog results. If `maybeCatalog` is `None`, then the session catalog is responsible for the identifier. Whether to use v1 or v2 after that point depends on the provider.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org