Skip to content

Commit 1c384b7

Browse files
committed
Minor code cleanup, restore the logging level hack in TestHive.scala
1 parent 7805c33 commit 1c384b7

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suite.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,10 @@ import org.apache.spark.sql.catalyst.util.getTempFilePath
4141
class HiveThriftServer2Suite extends FunSuite with Logging {
4242
Class.forName(classOf[HiveDriver].getCanonicalName)
4343

44-
val verbose = Option(System.getenv("SPARK_SQL_TEST_VERBOSE")).isDefined
45-
4644
def startThriftServerWithin(timeout: FiniteDuration = 1.minute)(f: Statement => Unit) {
47-
Thread.sleep(5000)
48-
4945
val startScript = "../../sbin/start-thriftserver.sh".split("/").mkString(File.separator)
5046
val stopScript = "../../sbin/stop-thriftserver.sh".split("/").mkString(File.separator)
47+
5148
val warehousePath = getTempFilePath("warehouse")
5249
val metastorePath = getTempFilePath("metastore")
5350
val metastoreJdbcUri = s"jdbc:derby:;databaseName=$metastorePath;create=true"
@@ -94,8 +91,9 @@ class HiveThriftServer2Suite extends FunSuite with Logging {
9491
.run(ProcessLogger(captureLogOutput, _ => ()))
9592
}
9693
}
97-
// reset SPARK_TESTING to avoid loading Log4J configurations in testing class paths
98-
Process(command, None, ("SPARK_TESTING", "0")).run(ProcessLogger(
94+
95+
// Resets SPARK_TESTING to avoid loading Log4J configurations in testing class paths
96+
Process(command, None, "SPARK_TESTING" -> "0").run(ProcessLogger(
9997
captureThriftServerOutput("stdout"),
10098
captureThriftServerOutput("stderr")))
10199

sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {
378378
*/
379379
def reset() {
380380
try {
381+
// HACK: Hive is too noisy by default.
382+
org.apache.log4j.LogManager.getCurrentLoggers.foreach { log =>
383+
log.asInstanceOf[org.apache.log4j.Logger].setLevel(org.apache.log4j.Level.WARN)
384+
}
385+
381386
clearCache()
382387
loadedTables.clear()
383388
catalog.client.getAllTables("default").foreach { t =>

0 commit comments

Comments
 (0)