rdblue commented on a change in pull request #24768: [SPARK-27919][SQL] Add v2 
session catalog
URL: https://github.com/apache/spark/pull/24768#discussion_r296304703
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceResolution.scala
 ##########
 @@ -60,11 +60,12 @@ case class DataSourceResolution(
     case create: CreateTableStatement =>
       // the provider was not a v1 source, convert to a v2 plan
       val CatalogObjectIdentifier(maybeCatalog, identifier) = create.tableName
-      val catalog = maybeCatalog.orElse(defaultCatalog)
-          .getOrElse(throw new AnalysisException(
-            s"No catalog specified for table ${identifier.quoted} and no 
default catalog is set"))
-          .asTableCatalog
-      convertCreateTable(catalog, identifier, create)
+      maybeCatalog match {
+        case Some(catalog) =>
+          convertCreateTable(catalog.asTableCatalog, identifier, create)
+        case _ =>
+          convertCreateTable(v2SessionCatalog.asTableCatalog, identifier, 
create)
 
 Review comment:
   I've updated this:
   
   ```
     // the identifier had no catalog and no default catalog is set, but the 
source is
     // use the v2 session catalog, which delegates to the global v1 session 
catalog
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to