Skip to content

Commit 03aea3c

Browse files
committed
Remove unneeded code in DataFrameWriter.insertInto.
1 parent ce3b98b commit 03aea3c

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -249,25 +249,12 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) {
249249
)
250250
}
251251

252-
val partitions = normalizedParCols.map(_.map(col => col -> Option.empty[String]).toMap)
253-
val overwrite = mode == SaveMode.Overwrite
254-
255-
// A partitioned relation's schema can be different from the input logicalPlan, since
256-
// partition columns are all moved after data columns. We Project to adjust the ordering.
257-
// TODO: this belongs to the analyzer.
258-
val input = normalizedParCols.map { parCols =>
259-
val (inputPartCols, inputDataCols) = df.logicalPlan.output.partition { attr =>
260-
parCols.contains(attr.name)
261-
}
262-
Project(inputDataCols ++ inputPartCols, df.logicalPlan)
263-
}.getOrElse(df.logicalPlan)
264-
265252
df.sparkSession.sessionState.executePlan(
266253
InsertIntoTable(
267-
UnresolvedRelation(tableIdent),
268-
partitions.getOrElse(Map.empty[String, Option[String]]),
269-
input,
270-
overwrite,
254+
table = UnresolvedRelation(tableIdent),
255+
partition = Map.empty[String, Option[String]],
256+
child = df.logicalPlan,
257+
overwrite = mode == SaveMode.Overwrite,
271258
ifNotExists = false)).toRdd
272259
}
273260

0 commit comments

Comments
 (0)