cloud-fan commented on a change in pull request #26219: [SPARK-29563][SQL] 
CREATE TABLE LIKE should look up catalog/table like v2 commands
URL: https://github.com/apache/spark/pull/26219#discussion_r345043711
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
 ##########
 @@ -187,6 +187,16 @@ case class CreateTableAsSelect(
   }
 }
 
+/**
+ * Create a new table with the same table definition of the source table.
+ */
+case class CreateTableLike(
+    targetCatalog: TableCatalog,
+    targetTableName: Seq[String],
+    sourceCatalog: Option[TableCatalog],
+    sourceTableName: Seq[String],
 
 Review comment:
   for the source table, what we really care is the table itself, not which 
catalog it comes from. I think it's better to define the plan as
   ```
   case class CreateTableLike(
       targetCatalog: TableCatalog,
       targetTableName: Seq[String],
       sourceTable: NamedRelation,
       ifNotExists: Boolean)
   ```
   
   In the planner, we match `CreateTableLike(..., r: DataSourceV2Relation, 
..)`, and create the physical plan with source table `r.table`

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