aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sql/core/src/test')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
index 1af1a36529..2a0e088437 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
@@ -634,4 +634,20 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext
assert(getNumInMemoryRelations(cachedPlan2) == 4)
}
}
+
+ test("refreshByPath should refresh all cached plans with the specified path") {
+ withTempDir { dir =>
+ val path = dir.getCanonicalPath()
+
+ spark.range(10).write.mode("overwrite").parquet(path)
+ spark.read.parquet(path).cache()
+ spark.read.parquet(path).filter($"id" > 4).cache()
+ assert(spark.read.parquet(path).filter($"id" > 4).count() == 5)
+
+ spark.range(20).write.mode("overwrite").parquet(path)
+ spark.catalog.refreshByPath(path)
+ assert(spark.read.parquet(path).count() == 20)
+ assert(spark.read.parquet(path).filter($"id" > 4).count() == 15)
+ }
+ }
}