Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-5538][SQL] Fix flaky CachedTableSuite #4379

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

package org.apache.spark.sql

import scala.concurrent.duration._
import scala.language.implicitConversions
import scala.language.postfixOps

import org.scalatest.concurrent.Eventually._

import org.apache.spark.sql.TestData._
import org.apache.spark.sql.columnar._
import org.apache.spark.sql.Dsl._
Expand Down Expand Up @@ -191,7 +197,10 @@ class CachedTableSuite extends QueryTest {

sql("UNCACHE TABLE testData")
assert(!isCached("testData"), "Table 'testData' should not be cached")
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")

eventually(timeout(10 seconds)) {
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
}
}

test("CACHE TABLE tableName AS SELECT * FROM anotherTable") {
Expand All @@ -204,7 +213,9 @@ class CachedTableSuite extends QueryTest {
"Eagerly cached in-memory table should have already been materialized")

uncacheTable("testCacheTable")
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
eventually(timeout(10 seconds)) {
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
}
}

test("CACHE TABLE tableName AS SELECT ...") {
Expand All @@ -217,7 +228,9 @@ class CachedTableSuite extends QueryTest {
"Eagerly cached in-memory table should have already been materialized")

uncacheTable("testCacheTable")
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
eventually(timeout(10 seconds)) {
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
}
}

test("CACHE LAZY TABLE tableName") {
Expand All @@ -235,7 +248,9 @@ class CachedTableSuite extends QueryTest {
"Lazily cached in-memory table should have been materialized")

uncacheTable("testData")
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
eventually(timeout(10 seconds)) {
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
}
}

test("InMemoryRelation statistics") {
Expand Down