Skip to content

Commit

Permalink
Minor code cleanup, restore the logging level hack in TestHive.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
liancheng committed Oct 11, 2014
1 parent 7805c33 commit 1c384b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ import org.apache.spark.sql.catalyst.util.getTempFilePath
class HiveThriftServer2Suite extends FunSuite with Logging {
Class.forName(classOf[HiveDriver].getCanonicalName)

val verbose = Option(System.getenv("SPARK_SQL_TEST_VERBOSE")).isDefined

def startThriftServerWithin(timeout: FiniteDuration = 1.minute)(f: Statement => Unit) {
Thread.sleep(5000)

val startScript = "../../sbin/start-thriftserver.sh".split("/").mkString(File.separator)
val stopScript = "../../sbin/stop-thriftserver.sh".split("/").mkString(File.separator)

val warehousePath = getTempFilePath("warehouse")
val metastorePath = getTempFilePath("metastore")
val metastoreJdbcUri = s"jdbc:derby:;databaseName=$metastorePath;create=true"
Expand Down Expand Up @@ -94,8 +91,9 @@ class HiveThriftServer2Suite extends FunSuite with Logging {
.run(ProcessLogger(captureLogOutput, _ => ()))
}
}
// reset SPARK_TESTING to avoid loading Log4J configurations in testing class paths
Process(command, None, ("SPARK_TESTING", "0")).run(ProcessLogger(

// Resets SPARK_TESTING to avoid loading Log4J configurations in testing class paths
Process(command, None, "SPARK_TESTING" -> "0").run(ProcessLogger(
captureThriftServerOutput("stdout"),
captureThriftServerOutput("stderr")))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {
*/
def reset() {
try {
// HACK: Hive is too noisy by default.
org.apache.log4j.LogManager.getCurrentLoggers.foreach { log =>
log.asInstanceOf[org.apache.log4j.Logger].setLevel(org.apache.log4j.Level.WARN)
}

clearCache()
loadedTables.clear()
catalog.client.getAllTables("default").foreach { t =>
Expand Down

0 comments on commit 1c384b7

Please sign in to comment.