Skip to content

[SPARK-4459] Change groupBy type parameter from K to U #3327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

alokito
Copy link

@alokito alokito commented Nov 17, 2014

@alokito alokito changed the title Patch to address SPARK-4459 Change groupBy type parameter from K to U to address SPARK-4459 Nov 17, 2014
@alokito alokito changed the title Change groupBy type parameter from K to U to address SPARK-4459 [SPARK-4459] Change groupBy type parameter from K to U to address Nov 17, 2014
@alokito alokito changed the title [SPARK-4459] Change groupBy type parameter from K to U to address [SPARK-4459] Change groupBy type parameter from K to U Nov 17, 2014
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@srowen
Copy link
Member

srowen commented Nov 17, 2014

LGTM. The question is whether this changes the binary or source compatibility. I don't think it changes source compatibility since it merely loosens a restriction. I don't think it would change the binary signature either? but MIMA will help know for sure.

Also, I think keyBy has the same issue?

@@ -322,6 +322,27 @@ public Boolean call(Integer x) {
Assert.assertEquals(2, Iterables.size(oddsAndEvens.lookup(true).get(0))); // Evens
Assert.assertEquals(5, Iterables.size(oddsAndEvens.lookup(false).get(0))); // Odds
}

@Test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Minor: indentation)

@sryza
Copy link
Contributor

sryza commented Nov 17, 2014

partitionBy as well?

@alokito
Copy link
Author

alokito commented Nov 18, 2014

I may have time to add some tests and patch keyBy and partitionBy tomorrow.

@alokito
Copy link
Author

alokito commented Nov 18, 2014

I addressed keyBy, but I think partitionBy does not actually have this issue, as the Partitioner abstract class does not take a type parameter - implementations such as RangePartitioner use asInstanceOf in getPartition.

@JoshRosen
Copy link
Contributor

It looks like you might have run into a Scala compiler bug, since in principle it shouldn't matter what we name that type parameter, since it's in a different scope than other type parameters. This looks a lot like https://issues.scala-lang.org/browse/SI-6057, which I hit while implementing the Java API and @tdas ran into while working on the Java API for Spark Streaming.

@JoshRosen
Copy link
Contributor

@alokito,

If you've got time, do you mind fixing up the indentation / formatting issues in the test suite so that I can merge this? If not, just let me know and I'll do it myself.

Function<scala.Tuple2<Integer, Integer>, String> areOdd = new Function<scala.Tuple2<Integer, Integer>, String>() {
@Override
public String call(scala.Tuple2<Integer, Integer> x) {
return ""+(x._1 +x._2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing here is messy. Also, "" + x is messy; just do x.toString() instead if you want to convert an object in a string.

@JoshRosen
Copy link
Contributor

I downloaded this and tested it out; everything looks fine, modulo these formatting issues. I've fixed the style issues myself and am going to merge this into master, branch-1.2, and branch-1.1. Thanks for fixing this!

(I ran the MiMa tests locally and this passes)

asfgit pushed a commit that referenced this pull request Dec 4, 2014
Please see https://issues.apache.org/jira/browse/SPARK-4459

Author: Saldanha <[email protected]>

Closes #3327 from alokito/master and squashes the following commits:

54b1095 [Saldanha] [SPARK-4459] changed type parameter for keyBy from K to U
d5f73c3 [Saldanha] [SPARK-4459] added keyBy test
316ad77 [Saldanha] SPARK-4459 changed type parameter for groupBy from K to U.
62ddd4b [Saldanha] SPARK-4459 added failing unit test
(cherry picked from commit 743a889)

Signed-off-by: Josh Rosen <[email protected]>
asfgit pushed a commit that referenced this pull request Dec 4, 2014
Please see https://issues.apache.org/jira/browse/SPARK-4459

Author: Saldanha <[email protected]>

Closes #3327 from alokito/master and squashes the following commits:

54b1095 [Saldanha] [SPARK-4459] changed type parameter for keyBy from K to U
d5f73c3 [Saldanha] [SPARK-4459] added keyBy test
316ad77 [Saldanha] SPARK-4459 changed type parameter for groupBy from K to U.
62ddd4b [Saldanha] SPARK-4459 added failing unit test
(cherry picked from commit 743a889)

Signed-off-by: Josh Rosen <[email protected]>
@asfgit asfgit closed this in 743a889 Dec 4, 2014
@alokito
Copy link
Author

alokito commented Dec 4, 2014

Thanks for fixing the style issues, I meant to but it's been a tough week.

On Dec 4, 2014, at 17:57, Josh Rosen [email protected] wrote:

I downloaded this and tested it out; everything looks fine, modulo these
formatting issues. I've fixed the style issues myself and am going to merge
this into master, branch-1.2, and branch-1.1. Thanks for fixing this!

(I ran the MiMa tests locally and this passes)


Reply to this email directly or view it on GitHub
#3327 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants