Skip to content

Commit 71b93ed

Browse files
committed
refine test cases
1 parent 0cd8dc1 commit 71b93ed

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -803,24 +803,15 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext
803803
assert(cachedData.collect === Seq(1001))
804804
}
805805

806-
test("SPARK-24596 Non-cascading Cache Invalidation") {
807-
withTempView("t1", "t2", "t3") {
808-
val rows = Seq(
809-
Row("p1", 30), Row("p2", 20), Row("p3", 25),
810-
Row("p4", 10), Row("p5", 40), Row("p6", 15))
811-
val schema = new StructType().add("name", StringType).add("age", IntegerType)
812-
813-
val rdd = spark.sparkContext.parallelize(rows, 3)
814-
val df = spark.createDataFrame(rdd, schema)
815-
df.createOrReplaceTempView("t1")
816-
817-
spark.sql("cache table t2 as select * from t1 where age >= 25")
818-
spark.sql("cache table t3 as select * from t2 where name = 'p1'")
806+
test("SPARK-24596 Non-cascading Cache Invalidation - drop temporary view") {
807+
withView("t1", "t2") {
808+
sql("CACHE TABLE t1 AS SELECT * FROM testData WHERE key > 1")
809+
sql("CACHE TABLE t2 as SELECT * FROM t1 WHERE value > 1")
819810

811+
assertCached(spark.table("t1"))
812+
assertCached(spark.table("t2"))
813+
sql("DROP VIEW t1")
820814
assertCached(spark.table("t2"))
821-
assertCached(spark.table("t3"))
822-
spark.catalog.dropTempView("t2")
823-
assertCached(spark.table("t3"))
824815
}
825816
}
826817
}

0 commit comments

Comments
 (0)