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

    https://github.com/apache/spark/pull/20521#discussion_r166517452
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/CreateHiveTableAsSelectCommand.scala
 ---
    @@ -72,13 +72,14 @@ case class CreateHiveTableAsSelectCommand(
             tableDesc.copy(schema = query.schema), ignoreIfExists = false)
     
           try {
    -        sparkSession.sessionState.executePlan(
    -          InsertIntoTable(
    -            UnresolvedRelation(tableIdentifier),
    -            Map(),
    -            query,
    -            overwrite = true,
    -            ifPartitionNotExists = false)).toRdd
    +        InsertIntoHiveTable(
    +          // Read back the metadata of the table which was created just 
now.
    +          
sparkSession.sessionState.catalog.getTableMetadata(tableDesc.identifier),
    +          Map.empty,
    +          query,
    +          overwrite = false,
    --- End diff --
    
    good catch!


---

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

Reply via email to