GitHub user wangyum opened a pull request: https://github.com/apache/spark/pull/22941
[SPARK-25936][SQL] Fix InsertIntoDataSourceCommand does not use Cached Data ## What changes were proposed in this pull request? ```java spark.sql(""" CREATE TABLE jdbcTable USING org.apache.spark.sql.jdbc OPTIONS ( url "jdbc:mysql://localhost:3306/test", dbtable "test.InsertIntoDataSourceCommand", user "hive", password "hive" )""") spark.range(2).createTempView("test_view") spark.catalog.cacheTable("test_view") spark.sql("INSERT INTO TABLE jdbcTable SELECT * FROM test_view").explain ``` Before this PR: ``` == Physical Plan == Execute InsertIntoDataSourceCommand +- InsertIntoDataSourceCommand +- Project +- SubqueryAlias +- Range (0, 2, step=1, splits=Some(8)) ``` After this PR: ``` == Physical Plan == Execute InsertIntoDataSourceCommand InsertIntoDataSourceCommand Relation[id#8L] JDBCRelation(test.InsertIntoDataSourceCommand) [numPartitions=1], false, [id] +- *(1) InMemoryTableScan [id#0L] +- InMemoryRelation [id#0L], StorageLevel(disk, memory, deserialized, 1 replicas) +- *(1) Range (0, 2, step=1, splits=8) ``` ## How was this patch tested? unit tests You can merge this pull request into a Git repository by running: $ git pull https://github.com/wangyum/spark SPARK-25936 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/22941.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #22941 ---- commit 2968b2c34f42f6b0bcb5e373a400377abfd09e86 Author: Yuming Wang <yumwang@...> Date: 2018-11-04T10:36:20Z Fix InsertIntoDataSourceCommand does not use Cached Data ---- --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org