Skip to content

Commit

Permalink
remove applying schema type for insert input
Browse files Browse the repository at this point in the history
  • Loading branch information
maryannxue committed Jun 19, 2018
1 parent f099a67 commit 8add169
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ case class InsertIntoDataSourceCommand(
override def run(sparkSession: SparkSession): Seq[Row] = {
val relation = logicalRelation.relation.asInstanceOf[InsertableRelation]
val data = Dataset.ofRows(sparkSession, query)
// Apply the schema of the existing table to the new data.
val df = sparkSession.internalCreateDataFrame(
data.queryExecution.toRdd, logicalRelation.schema.asNullable)
relation.insert(df, overwrite)
// Data should have been casted to the schema of the insert relation.
relation.insert(data, overwrite)

// Re-cache all cached plans(including this relation itself, if it's cached) that refer to this
// data source relation.
Expand Down

0 comments on commit 8add169

Please sign in to comment.