You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by srowen <gi...@git.apache.org> on 2014/05/30 13:38:47 UTC

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

GitHub user srowen opened a pull request:

    https://github.com/apache/spark/pull/919

    SPARK-1973. Add randomSplit to JavaRDD (with tests, and tidy Java tests)

    I'd like to use randomSplit through the Java API, and would like to add a convenience wrapper for this method to JavaRDD. This is fairly trivial. (In fact, is the intent that JavaRDD not wrap every RDD method? and that sometimes users should just use JavaRDD.wrapRDD()?)
    
    Along the way, I added tests for it, and also touched up the Java API test style and behavior. This is maybe the more useful part of this small change.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/srowen/spark SPARK-1973

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/919.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #919
    
----
commit df9cdb9d9c42d88022a092eea5a3224575086256
Author: Sean Owen <so...@cloudera.com>
Date:   2014-05-11T16:42:16Z

    Touch up minor style issues in existing Java API suite test

commit be57987215dae92180ca9f40068e045377586c14
Author: Sean Owen <so...@cloudera.com>
Date:   2014-05-13T12:41:42Z

    Simplified Java 8 test with new language features, and fixed the name of MLB's greatest team

commit e0f3b543e3cb03abeccbb6e4e69cfb42d922fdfb
Author: Sean Owen <so...@cloudera.com>
Date:   2014-05-13T14:06:17Z

    Add Java randomSplit, and unit tests (including for sample)

----


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45012013
  
    @srowen It is not mergeable now. Could you try to merge the master branch first? Also, I did some further cleaning but I couldn't send a PR to your repo (cannot find your repo from the list). Can you merge `https://github.com/mengxr/spark/tree/SPARK-1973` as well? Thanks!


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45131154
  
    Merged. Thanks!


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44644853
  
    Merged build finished. All automated tests passed.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45075841
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15443/


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45019424
  
     Merged build triggered. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44883451
  
     Merged build triggered. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/919#discussion_r13297439
  
    --- Diff: core/src/test/java/org/apache/spark/JavaAPISuite.java ---
    @@ -164,26 +176,26 @@ public void sortByKey() {
         Assert.assertEquals(new Tuple2<Integer, Integer>(3, 2), sortedPairs.get(2));
     
         // Custom comparator
    -    sortedRDD = rdd.sortByKey(new ReverseIntComparator(), false);
    +    sortedRDD = rdd.sortByKey(Collections.<Integer>reverseOrder(), false);
         Assert.assertEquals(new Tuple2<Integer, Integer>(-1, 1), sortedRDD.first());
         sortedPairs = sortedRDD.collect();
         Assert.assertEquals(new Tuple2<Integer, Integer>(0, 4), sortedPairs.get(1));
         Assert.assertEquals(new Tuple2<Integer, Integer>(3, 2), sortedPairs.get(2));
       }
     
    -  static int foreachCalls = 0;
    -
       @Test
       public void foreach() {
    -    foreachCalls = 0;
    +    final File tempDir = Files.createTempDir();
    --- End diff --
    
    Let me look into that. This was intended to be less fragile that relying on a class variable that happens to be shared, but maybe an accumulator is even more robust.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45075840
  
    Build finished. All automated tests passed.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/919#discussion_r13378684
  
    --- Diff: core/src/test/java/org/apache/spark/JavaAPISuite.java ---
    @@ -145,6 +135,27 @@ public void intersection() {
       }
     
       @Test
    +  public void sample() {
    +    List<Integer> ints = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    +    JavaRDD<Integer> rdd = sc.parallelize(ints);
    +    JavaRDD<Integer> sample20 = rdd.sample(true, 0.2, 11);
    +    Assert.assertEquals(3, sample20.count()); // expected 2 but of course result varies randomly a bit
    --- End diff --
    
    Oops, fixed, and I fixed other pre-existing long lines while at it.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45024281
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15403/


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44883461
  
    Merged build started. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44887924
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15353/


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45024278
  
    Merged build finished. All automated tests passed.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/919#discussion_r13297343
  
    --- Diff: core/src/test/java/org/apache/spark/JavaAPISuite.java ---
    @@ -164,26 +176,26 @@ public void sortByKey() {
         Assert.assertEquals(new Tuple2<Integer, Integer>(3, 2), sortedPairs.get(2));
     
         // Custom comparator
    -    sortedRDD = rdd.sortByKey(new ReverseIntComparator(), false);
    +    sortedRDD = rdd.sortByKey(Collections.<Integer>reverseOrder(), false);
         Assert.assertEquals(new Tuple2<Integer, Integer>(-1, 1), sortedRDD.first());
         sortedPairs = sortedRDD.collect();
         Assert.assertEquals(new Tuple2<Integer, Integer>(0, 4), sortedPairs.get(1));
         Assert.assertEquals(new Tuple2<Integer, Integer>(3, 2), sortedPairs.get(2));
       }
     
    -  static int foreachCalls = 0;
    -
       @Test
       public void foreach() {
    -    foreachCalls = 0;
    +    final File tempDir = Files.createTempDir();
    --- End diff --
    
    Can we use accumulator to test `foreach`? Creating new files makes the test a little complicated.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/919#discussion_r13297553
  
    --- Diff: extras/java8-tests/src/test/java/org/apache/spark/streaming/Java8APISuite.java ---
    @@ -63,7 +64,7 @@ public void testMap() {
       public void testFilter() {
         List<List<String>> inputData = Arrays.asList(
           Arrays.asList("giants", "dodgers"),
    -      Arrays.asList("yankees", "red socks"));
    +      Arrays.asList("yankees", "red sox"));
    --- End diff --
    
    nice catch!


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44887923
  
    Merged build finished. All automated tests passed.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/919


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45073006
  
    Build started. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/919#discussion_r13371699
  
    --- Diff: core/src/test/java/org/apache/spark/JavaAPISuite.java ---
    @@ -145,6 +135,27 @@ public void intersection() {
       }
     
       @Test
    +  public void sample() {
    +    List<Integer> ints = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    +    JavaRDD<Integer> rdd = sc.parallelize(ints);
    +    JavaRDD<Integer> sample20 = rdd.sample(true, 0.2, 11);
    +    Assert.assertEquals(3, sample20.count()); // expected 2 but of course result varies randomly a bit
    --- End diff --
    
    This line is too wide.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45072382
  
     Build triggered. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45019534
  
    Merged build started. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-45019218
  
    Done -- rebased, added your commit, and a few more of my own.


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44642038
  
    Merged build started. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44642027
  
     Merged build triggered. 


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

[GitHub] spark pull request: SPARK-1973. Add randomSplit to JavaRDD (with t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/919#issuecomment-44644854
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15304/


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