Github user xuanyuanking commented on a diff in the pull request: https://github.com/apache/spark/pull/19941#discussion_r156661304 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala --- @@ -490,20 +489,19 @@ case class DataSource( } /** - * Writes the given [[LogicalPlan]] out to this [[DataSource]] and returns a [[BaseRelation]] for - * the following reading. + * Returns a [[BaseRelation]] for creating table after `planForWriting`. Only use + * in `CreateDataSourceTableAsSelectCommand` while saving data to non-existing table. */ - def writeAndRead(mode: SaveMode, data: LogicalPlan): BaseRelation = { + def getRelation(mode: SaveMode, data: LogicalPlan): BaseRelation = { if (data.schema.map(_.dataType).exists(_.isInstanceOf[CalendarIntervalType])) { throw new AnalysisException("Cannot save interval data type into external storage.") } providingClass.newInstance() match { - case dataSource: CreatableRelationProvider => + case dataSource: RelationProvider => --- End diff -- If here use `CreatableRelationProvider.createRelation`, will it write to destination one more time?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org