Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16#discussion_r11323529
  
    --- Diff: 
extras/java8-tests/src/test/java/org/apache/spark/Java8APISuite.java ---
    @@ -246,6 +246,24 @@ public void mapPartitions() {
       }
     
       @Test
    +  public void mapPartitionsWithIndex() {
    +    JavaRDD<Integer> rdd = sc.parallelize(Arrays.asList(1, 2, 3, 4), 2);
    +    JavaRDD<Integer> partitionSums = rdd.mapPartitionsWithIndex((start, 
iter) -> {
    +      List<Integer> list = new ArrayList<Integer>();
    +      int sum = 0;
    +      int pos = start;
    +      while (iter.hasNext()) {
    +     sum += (pos* iter.next());
    +   pos += 1;
    +      }
    +      return list.iterator();
    +    });
    +   Assert.assertEquals(0, rddByIndex.first().intValue());
    +   Integer[] values = {0, 2, 6, 12, 20};
    +   Assert.assertEquals(Arrays.asList(values), rddByIndex.collect());
    --- End diff --
    
    Actually this test is just broken as is, there's no `rddByIndex` variable. 
You have to run it on Java 8, otherwise SBT will not build this project.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to