Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/20521#discussion_r166510668 --- 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 -- previously, overwrite = true.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org