Skip to content

Commit

Permalink
More tests, and Mima-exclude the new isEmpty method in JavaRDDLike
Browse files Browse the repository at this point in the history
  • Loading branch information
srowen committed Jan 18, 2015
1 parent 28395ff commit 2e9b490
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/src/test/java/org/apache/spark/JavaAPISuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,20 @@ public void isEmpty() {
Assert.assertTrue(sc.emptyRDD().isEmpty());
Assert.assertTrue(sc.parallelize(new ArrayList<Integer>()).isEmpty());
Assert.assertFalse(sc.parallelize(Arrays.asList(1)).isEmpty());
Assert.assertTrue(sc.parallelize(Arrays.asList(1, 2, 3), 3).filter(
new Function<Integer,Boolean>() {
@Override
public Boolean call(Integer i) {
return i < 0;
}
}).isEmpty());
Assert.assertFalse(sc.parallelize(Arrays.asList(1, 2, 3)).filter(
new Function<Integer, Boolean>() {
@Override
public Boolean call(Integer i) {
return i > 1;
}
}).isEmpty());
}

@Test
Expand Down
2 changes: 2 additions & 0 deletions core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ class RDDSuite extends FunSuite with SharedSparkContext {
assert(sc.emptyRDD.isEmpty())
assert(sc.parallelize(Seq[Int]()).isEmpty())
assert(!sc.parallelize(Seq(1)).isEmpty())
assert(sc.parallelize(Seq(1,2,3), 3).filter(_ < 0).isEmpty())
assert(!sc.parallelize(Seq(1,2,3), 3).filter(_ > 1).isEmpty())
}

test("sample preserves partitioner") {
Expand Down
4 changes: 4 additions & 0 deletions project/MimaExcludes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ object MimaExcludes {
// SPARK-5166 Spark SQL API stabilization
ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.apache.spark.ml.Transformer.transform"),
ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.apache.spark.ml.Estimator.fit")
) ++ Seq(
// SPARK-5270
ProblemFilters.exclude[MissingMethodProblem](
"org.apache.spark.api.java.JavaRDDLike.isEmpty")
)

case v if v.startsWith("1.2") =>
Expand Down

0 comments on commit 2e9b490

Please sign in to comment.