Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/2187#discussion_r16874969
--- Diff:
core/src/test/scala/org/apache/spark/util/collection/ExternalAppendOnlyMapSuite.scala
---
@@ -200,77 +204,127 @@ class ExternalAppendOnlyMapSuite extends FunSuite
with LocalSparkContext {
result.foreach { case (i, (seq1, seq2)) =>
i match {
- case 0 => assert(seq1.toSet == Set[Int]() && seq2.toSet ==
Set[Int](2, 4))
- case 1 => assert(seq1.toSet == Set[Int](1) && seq2.toSet ==
Set[Int](1, 3))
- case 2 => assert(seq1.toSet == Set[Int](2) && seq2.toSet ==
Set[Int]())
- case 3 => assert(seq1.toSet == Set[Int](3) && seq2.toSet ==
Set[Int]())
- case 4 => assert(seq1.toSet == Set[Int](4) && seq2.toSet ==
Set[Int]())
+ case 0 => assert(seq1.toSet === Set[Int]() && seq2.toSet ===
Set[Int](2, 4))
+ case 1 => assert(seq1.toSet === Set[Int](1) && seq2.toSet ===
Set[Int](1, 3))
+ case 2 => assert(seq1.toSet === Set[Int](2) && seq2.toSet ===
Set[Int]())
+ case 3 => assert(seq1.toSet === Set[Int](3) && seq2.toSet ===
Set[Int]())
+ case 4 => assert(seq1.toSet === Set[Int](4) && seq2.toSet ===
Set[Int]())
}
}
+ sc.stop()
}
+ /**
+ * For tests that involve spilling, run them multiple times with
different compression settings.
+ */
+
test("spilling") {
- val conf = createSparkConf(true) // Load defaults, otherwise
SPARK_HOME is not found
+ runSpillingTest(testSpilling)
+ }
+
+ test("spilling with hash collisions") {
+ runSpillingTest(testSpillingWithCollisions)
+ }
+
+ test("spilling with many hash collisions") {
+ runSpillingTest(testSpillingWithManyCollisions)
+ }
+
+ test("spilling with hash collisions using the Int.MaxValue key") {
+ runSpillingTest(testSpillingWithCollisionsMaxInt)
+ }
+
+ test("spilling with null keys and values") {
+ runSpillingTest(testSpillingWithNullKeysAndValues)
+ }
+
+ /* ------------------------------------ *
+ * Actual test logic for spilling tests *
+ * ------------------------------------ */
+
+ /**
+ * Run a spilling test multiple times, with and without compression and
using all codecs.
+ */
+ private def runSpillingTest(test: Option[String] => Unit): Unit = {
--- End diff --
A cool trick I used in YarnSparkHadoopUtilSuite is to do something like
this:
def spillingTest(name: String)(testFn: => Unit) = test(name) {
blah blah blah testFn() blah
}
Then you can register like this:
spillingTest("spilling with null keys and values") {
// body of testSpillingWithNullKeysAndValues
}
Would look a little bit cleaner overall, but no biggie.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]