Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22514#discussion_r227654240
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/CreateHiveTableAsSelectCommand.scala
 ---
    @@ -45,6 +46,11 @@ case class CreateHiveTableAsSelectCommand(
     
       override def run(sparkSession: SparkSession, child: SparkPlan): Seq[Row] 
= {
         val catalog = sparkSession.sessionState.catalog
    +    val metastoreCatalog = 
catalog.asInstanceOf[HiveSessionCatalog].metastoreCatalog
    +
    +    // Whether this table is convertible to data source relation.
    +    val isConvertible = metastoreCatalog.isConvertible(tableDesc)
    --- End diff --
    
    another idea: can we move this logic to the `RelationConversions` rule? e.g.
    ```
    case CreateTable(tbl, mode, Some(query)) if DDLUtils.isHiveTable(tbl) && 
isConvertible(tbl) =>
      Union(CreateTable(tbl, mode, None), InsertIntoTable ...)
    ```


---

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

Reply via email to