Skip to content

Commit 7f28910

Browse files
committed
Fix CachedTableSuite tests.
1 parent 90cf403 commit 7f28910

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext
4646
}
4747

4848
def isMaterialized(rddId: Int): Boolean = {
49-
sparkContext.env.blockManager.get(RDDBlockId(rddId, 0)).nonEmpty
49+
val maybeBlock = sparkContext.env.blockManager.get(RDDBlockId(rddId, 0))
50+
maybeBlock.foreach(_ => sparkContext.env.blockManager.release(RDDBlockId(rddId, 0)))
51+
maybeBlock.nonEmpty
5052
}
5153

5254
test("withColumn doesn't invalidate cached dataframe") {

sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ class CachedTableSuite extends QueryTest with TestHiveSingleton {
4040
}
4141

4242
def isMaterialized(rddId: Int): Boolean = {
43-
sparkContext.env.blockManager.get(RDDBlockId(rddId, 0)).nonEmpty
43+
val maybeBlock = sparkContext.env.blockManager.get(RDDBlockId(rddId, 0))
44+
maybeBlock.foreach(_ => sparkContext.env.blockManager.release(RDDBlockId(rddId, 0)))
45+
maybeBlock.nonEmpty
4446
}
4547

4648
test("cache table") {

0 commit comments

Comments
 (0)