Skip to content

Commit

Permalink
Run Hive tests in-memory too.
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus authored and liancheng committed Apr 11, 2014
1 parent 6360723 commit 2d0e168
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class TestHiveContext(sc: SparkContext) extends LocalHiveContext(sc) {

private val loadedTables = new collection.mutable.HashSet[String]

var cacheTables: Boolean = false
def loadTestTable(name: String) {
if (!(loadedTables contains name)) {
// Marks the table as loaded first to prevent infite mutually recursive table loading.
Expand All @@ -265,6 +266,9 @@ class TestHiveContext(sc: SparkContext) extends LocalHiveContext(sc) {
val createCmds =
testTables.get(name).map(_.commands).getOrElse(sys.error(s"Unknown test table $name"))
createCmds.foreach(_())

if (cacheTables)
cacheTable(name)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
package org.apache.spark.sql.hive.execution

import org.apache.spark.sql.hive.TestHive
import org.scalatest.BeforeAndAfter

class HiveInMemoryCompatibilitySuite extends HiveCompatibilitySuite with BeforeAndAfter {
override def beforeAll() {
TestHive.cacheTables = true
}

override def afterAll() {
TestHive.cacheTables = false
}
}

/**
* Runs the test cases that are included in the hive distribution.
Expand Down

0 comments on commit 2d0e168

Please sign in to comment.