diff options
author | windpiger <songjun@outlook.com> | 2017-02-28 11:59:18 -0800 |
---|---|---|
committer | Wenchen Fan <wenchen@databricks.com> | 2017-02-28 11:59:18 -0800 |
commit | ce233f18e381fa1ea00be74ca26e97d35baa6c9c (patch) | |
tree | 3ea6727866bbd54ff34e57c93e91d7b6481f2ce9 /sql/hive | |
parent | 9734a928a75d29ea202e9f309f92ca4637d35671 (diff) | |
download | spark-ce233f18e381fa1ea00be74ca26e97d35baa6c9c.tar.gz spark-ce233f18e381fa1ea00be74ca26e97d35baa6c9c.tar.bz2 spark-ce233f18e381fa1ea00be74ca26e97d35baa6c9c.zip |
[SPARK-19463][SQL] refresh cache after the InsertIntoHadoopFsRelationCommand
## What changes were proposed in this pull request?
If we first cache a DataSource table, then we insert some data into the table, we should refresh the data in the cache after the insert command.
## How was this patch tested?
unit test added
Author: windpiger <songjun@outlook.com>
Closes #16809 from windpiger/refreshCacheAfterInsert.
Diffstat (limited to 'sql/hive')
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala index 3871b3d785..8ccc2b7527 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala @@ -204,13 +204,8 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with TestHiveSingleto assertCached(table("refreshTable")) // Append new data. table("src").write.mode(SaveMode.Append).parquet(tempPath.toString) - // We are still using the old data. assertCached(table("refreshTable")) - checkAnswer( - table("refreshTable"), - table("src").collect()) - // Refresh the table. - sql("REFRESH TABLE refreshTable") + // We are using the new data. assertCached(table("refreshTable")) checkAnswer( @@ -249,13 +244,8 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with TestHiveSingleto assertCached(table("refreshTable")) // Append new data. table("src").write.mode(SaveMode.Append).parquet(tempPath.toString) - // We are still using the old data. assertCached(table("refreshTable")) - checkAnswer( - table("refreshTable"), - table("src").collect()) - // Refresh the table. - sql(s"REFRESH ${tempPath.toString}") + // We are using the new data. assertCached(table("refreshTable")) checkAnswer( |