Skip to content

Commit b1e3f82

Browse files
committed
Revert "Hacky WIP towards speculatively running w/o reset(), then retrying with it."
This reverts commit 8113eac.
1 parent bf30fee commit b1e3f82

2 files changed

Lines changed: 7 additions & 35 deletions

File tree

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,7 @@ abstract class HiveComparisonTest
207207
}
208208

209209
val installHooksCommand = "(?i)SET.*hooks".r
210-
def createQueryTest(
211-
testCaseName: String,
212-
sql: String,
213-
reset: Boolean = true,
214-
tryWithoutResettingFirst: Boolean = false) {
210+
def createQueryTest(testCaseName: String, sql: String, reset: Boolean = true) {
215211
// testCaseName must not contain ':', which is not allowed to appear in a filename of Windows
216212
assert(!testCaseName.contains(":"))
217213

@@ -242,6 +238,9 @@ abstract class HiveComparisonTest
242238
test(testCaseName) {
243239
logDebug(s"=== HIVE TEST: $testCaseName ===")
244240

241+
// Clear old output for this testcase.
242+
outputDirectories.map(new File(_, testCaseName)).filter(_.exists()).foreach(_.delete())
243+
245244
val sqlWithoutComment =
246245
sql.split("\n").filterNot(l => l.matches("--.*(?<=[^\\\\]);")).mkString("\n")
247246
val allQueries =
@@ -268,10 +267,7 @@ abstract class HiveComparisonTest
268267
}.mkString("\n== Console version of this test ==\n", "\n", "\n")
269268
}
270269

271-
def doTest(reset: Boolean, isSpeculative: Boolean = false): Unit = {
272-
// Clear old output for this testcase.
273-
outputDirectories.map(new File(_, testCaseName)).filter(_.exists()).foreach(_.delete())
274-
270+
try {
275271
if (reset) {
276272
TestHive.reset()
277273
}
@@ -394,36 +390,12 @@ abstract class HiveComparisonTest
394390
""".stripMargin
395391

396392
stringToFile(new File(wrongDirectory, testCaseName), errorMessage + consoleTestCase)
397-
if (isSpeculative && !reset) {
398-
// TODO: log this at a very low level that won't appear in the console appender
399-
// then throw a custom exception
400-
fail("Failed on first run; retrying")
401-
} else {
402-
fail(errorMessage)
403-
}
393+
fail(errorMessage)
404394
}
405395
}
406396

407397
// Touch passed file.
408398
new FileOutputStream(new File(passedDirectory, testCaseName)).close()
409-
}
410-
411-
try {
412-
try {
413-
if (tryWithoutResettingFirst) {
414-
doTest(reset = false, isSpeculative = true)
415-
} else {
416-
doTest(reset)
417-
}
418-
} catch {
419-
case tf: org.scalatest.exceptions.TestFailedException =>
420-
if (tryWithoutResettingFirst) {
421-
logWarning("Test failed without reset(); retrying with reset()")
422-
doTest(reset = true)
423-
} else {
424-
throw tf
425-
}
426-
}
427399
} catch {
428400
case tf: org.scalatest.exceptions.TestFailedException => throw tf
429401
case originalException: Exception =>

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQueryFileTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ abstract class HiveQueryFileTest extends HiveComparisonTest {
5959
runAll) {
6060
// Build a test case and submit it to scala test framework...
6161
val queriesString = fileToString(testCaseFile)
62-
createQueryTest(testCaseName, queriesString, reset = true, tryWithoutResettingFirst = true)
62+
createQueryTest(testCaseName, queriesString)
6363
} else {
6464
// Only output warnings for the built in whitelist as this clutters the output when the user
6565
// trying to execute a single test from the commandline.

0 commit comments

Comments
 (0)