jose-torres commented on a change in pull request #25651: [SPARK-28948][SQL] 
support data source v2 in CREATE TABLE USING
URL: https://github.com/apache/spark/pull/25651#discussion_r320536110
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalog.scala
 ##########
 @@ -63,6 +63,61 @@ class V2SessionCatalog(sessionState: SessionState) extends 
TableCatalog {
     }
   }
 
+  override def tableExists(ident: Identifier): Boolean = {
+    if (ident.namespace().length <= 1) {
+      catalog.tableExists(ident.asTableIdentifier)
+    } else {
+      false
+    }
+  }
+
+  private def convertV1TableToV2(provider: TableProvider, v1Table: 
CatalogTable): Table = {
+    val options: Map[String, String] = {
+      v1Table.storage.locationUri match {
+        case Some(uri) =>
+          v1Table.storage.properties + ("path" -> uri.toString)
+        case _ =>
+          v1Table.storage.properties
+      }
+    }
+
+    val partitioning: Array[Transform] = {
+      val partitions = new mutable.ArrayBuffer[Transform]()
+
+      v1Table.partitionColumnNames.foreach { col =>
+        partitions += LogicalExpressions.identity(col)
 
 Review comment:
   Nit: This parses the column's name as a multi-part identifier, which is 
subtly incorrect. (It'll cause issues if the column name contains special 
characters like ':'.)

----------------------------------------------------------------
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