aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorDilip Biswal <dbiswal@us.ibm.com>2017-01-25 21:50:45 -0800
committergatorsmile <gatorsmile@gmail.com>2017-01-25 21:50:45 -0800
commit9effc2cdcb3d68db8b6b5b3abd75968633b583c8 (patch)
tree3fdc107154af12986826d944c9a5d491dae8f157 /sql
parent256a3a801366ab9f705e50690114e49fdb49b38e (diff)
downloadspark-9effc2cdcb3d68db8b6b5b3abd75968633b583c8.tar.gz
spark-9effc2cdcb3d68db8b6b5b3abd75968633b583c8.tar.bz2
spark-9effc2cdcb3d68db8b6b5b3abd75968633b583c8.zip
[TESTS][SQL] Setup testdata at the beginning for tests to run independently
## What changes were proposed in this pull request? In CachedTableSuite, we are not setting up the test data at the beginning. Some tests fail while trying to run individually. When running the entire suite they run fine. Here are some of the tests that fail - - test("SELECT star from cached table") - test("Self-join cached") As part of this simplified a couple of tests by calling a support method to count the number of InMemoryRelations. ## How was this patch tested? Ran the failing tests individually. Author: Dilip Biswal <dbiswal@us.ibm.com> Closes #16688 from dilipbiswal/cachetablesuite_simple.
Diffstat (limited to 'sql')
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala4
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala4
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala4
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala11
4 files changed, 10 insertions, 13 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala b/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
index 24b9b810fc..5ee173f72e 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
@@ -2588,8 +2588,8 @@ class Dataset[T] private[sql](
*
* Global temporary view is cross-session. Its lifetime is the lifetime of the Spark application,
* i.e. it will be automatically dropped when the application terminates. It's tied to a system
- * preserved database `_global_temp`, and we must use the qualified name to refer a global temp
- * view, e.g. `SELECT * FROM _global_temp.view1`.
+ * preserved database `global_temp`, and we must use the qualified name to refer a global temp
+ * view, e.g. `SELECT * FROM global_temp.view1`.
*
* @throws AnalysisException if the view name is invalid or already exists
*
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala b/sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala
index 41e781ed18..50252db789 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/catalog/Catalog.scala
@@ -380,8 +380,8 @@ abstract class Catalog {
*
* Global temporary view is cross-session. Its lifetime is the lifetime of the Spark application,
* i.e. it will be automatically dropped when the application terminates. It's tied to a system
- * preserved database `_global_temp`, and we must use the qualified name to refer a global temp
- * view, e.g. `SELECT * FROM _global_temp.view1`.
+ * preserved database `global_temp`, and we must use the qualified name to refer a global temp
+ * view, e.g. `SELECT * FROM global_temp.view1`.
*
* @param viewName the name of the view to be dropped.
* @return true if the view is dropped successfully, false otherwise.
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
index bb166f1030..921c848955 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
@@ -47,8 +47,8 @@ object LocalTempView extends ViewType
/**
* GlobalTempView means cross-session global temporary views. Its lifetime is the lifetime of the
* Spark application, i.e. it will be automatically dropped when the application terminates. It's
- * tied to a system preserved database `_global_temp`, and we must use the qualified name to refer a
- * global temp view, e.g. SELECT * FROM _global_temp.view1.
+ * tied to a system preserved database `global_temp`, and we must use the qualified name to refer a
+ * global temp view, e.g. SELECT * FROM global_temp.view1.
*/
object GlobalTempView extends ViewType
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 339262a5a3..1af1a36529 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
@@ -39,6 +39,8 @@ private case class BigData(s: String)
class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext {
import testImplicits._
+ setupTestData()
+
override def afterEach(): Unit = {
try {
spark.catalog.clearCache()
@@ -185,9 +187,7 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext
assertCached(spark.table("testData"))
assertResult(1, "InMemoryRelation not found, testData should have been cached") {
- spark.table("testData").queryExecution.withCachedData.collect {
- case r: InMemoryRelation => r
- }.size
+ getNumInMemoryRelations(spark.table("testData").queryExecution.withCachedData)
}
spark.catalog.cacheTable("testData")
@@ -580,10 +580,7 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext
localRelation.createOrReplaceTempView("localRelation")
spark.catalog.cacheTable("localRelation")
- assert(
- localRelation.queryExecution.withCachedData.collect {
- case i: InMemoryRelation => i
- }.size == 1)
+ assert(getNumInMemoryRelations(localRelation.queryExecution.withCachedData) == 1)
}
test("SPARK-19093 Caching in side subquery") {