Uh oh!
There was an error while loading. Please reload this page.
[SPARK-9043] Serialize key, value and combiner classes in ShuffleDependency - #7403
[SPARK-9043] Serialize key, value and combiner classes in ShuffleDependency#7403massie wants to merge 4 commits into
Conversation
massie
commented
Jul 14, 2015
Jenkins, test this please. |
massie
commented
Jul 14, 2015
There was a timeout fetching from the git repo. Having Jenkins try again. |
There was a problem hiding this comment.
FYI, this is a binary-incompatible change to a DeveloperAPI.
There was a problem hiding this comment.
According to the source for DeveloperApi, a Developer API is unstable and can change between minor releases.
JoshRosen
commented
Jul 14, 2015
I don't think that we can make this change as-is since we can't break binary compatibility for stable public APIs like PairRDDFunctions. |
massie
commented
Jul 14, 2015
@JoshRosen What suggestions do you have for making the key, value and combiner class names available in the ShuffleDependency in a way that is binary compatible? I had assumed that this would be part of the next major release where binary changes might be allowed. |
massie
commented
Jul 14, 2015
Also, the comment in the |
massie
commented
Jul 14, 2015
The Luckily, the original PairRDDFunctions has ClassTags for the key and value; however, the |
SparkQA
commented
Jul 14, 2015
Test build #37268 has finished for PR 7403 at commit
|
rxin
commented
Jul 15, 2015
@massie Although I'm in favor of collecting more type information (e.g. even type tags), but no labeling means it should be stable across the entire Spark 1.x release... |
massie
commented
Jul 15, 2015
@JoshRosen@rxin I just pushed an update that reverts the The only remaining sticking point is the three |
SparkQA
commented
Jul 15, 2015
Test build #37380 has finished for PR 7403 at commit
|
massie
commented
Jul 15, 2015
To answer my own question, adding a |
massie
commented
Jul 15, 2015
I just pushed an update (5c58b4df9b) which ensures that we keep binary compatibility in If this is an approach that is agreeable, I'll expand the tests and finalize the work. Any suggestions on a better name of the new combiner methods? I just called it Thanks for the review help @JoshRosen and @rxin. |
SparkQA
commented
Jul 16, 2015
Test build #37423 has finished for PR 7403 at commit
|
massie
commented
Jul 17, 2015
There is another approach that would work here too. Currently, objectRDD {
defrddToPairRDDFunctions[K, V](rdd: RDD[(K, V)])
(implicitkt: ClassTag[K], vt: ClassTag[V], ord: Ordering[K] =null):PairRDDFunctions[K, V] = {
newPairRDDFunctions(rdd)
}Code compiled with this looks like the following, To keep binary compatibility, we just need to keep the objectRDD {
defrddToPairRDDFunctions[K, V](rdd: RDD[(K, V)])
(implicitkt: ClassTag[K], vt: ClassTag[V], ord: Ordering[K] =null):PairRDDFunctions[K, V] = {
newPairRDDFunctions(rdd)
}
implicitdefrddToNewPairRDDFunctions[K, V](rdd: RDD[(K, V)])
(implicitkt: ClassTag[K], vt: ClassTag[V], ord: Ordering[K] =null):NewPairRDDFunctions[K, V] = {
newNewPairRDDFunctions(rdd)
}
...
}Old code will still run since the As a small side note, the The advantage of this approach is that the method names remain the same (no need for a |
SparkQA
commented
Jul 22, 2015
Test build #37988 has finished for PR 7403 at commit
|
massie
commented
Jul 23, 2015
This is ready for review when someone has the time. All unit tests pass.
|
There was a problem hiding this comment.
how is this used? it might require the key class to have a 0-arg ctor right?
There was a problem hiding this comment.
Here's an example of how I use this in the Parquet shuffle manager to create a schema for the (key, value) or (key, combiner) pairs for the shuffle files.
SparkQA
commented
Jul 24, 2015
Test build #38310 has finished for PR 7403 at commit
|
massie
commented
Jul 24, 2015
Jenkins, test this please. |
1 similar comment
massie
commented
Jul 24, 2015
Jenkins, test this please. |
SparkQA
commented
Jul 24, 2015
Test build #38367 has finished for PR 7403 at commit
|
massie
commented
Jul 24, 2015
Jenkins tests pass. The other failures were Jenkins hiccups. |
There was a problem hiding this comment.
These ClassTags should not be removed. I just pushed an update that reverts this line change.
SparkQA
commented
Jul 25, 2015
Test build #38403 has finished for PR 7403 at commit
|
SparkQA
commented
Jul 25, 2015
Test build #38406 has finished for PR 7403 at commit
|
massie
commented
Jul 25, 2015
The error isn't related to this PR... ... looks like something related to Kinesis backed streaming. Maybe related to Maybe @tdas knows what's causing the failure? |
There was a problem hiding this comment.
I missed this in my style changes. Fixing now.
massie
commented
Sep 1, 2015
@andrewor14 I noticed that I missed a few of the style fixes that you recommended. I just pushed 41d2a3c which fixes them. Thanks for the reviewing this PR. I appreciate it. |
SparkQA
commented
Sep 1, 2015
Test build #41897 has finished for PR 7403 at commit
|
SparkQA
commented
Sep 2, 2015
Test build #41893 has finished for PR 7403 at commit
|
massie
commented
Sep 8, 2015
@rxin and @andrewor14 - Is there anything more that needs to be done before this PR is ready to be merged? I've made all recommended changes. There is an open question about having the class names be (a) This PR is ready to go for Option A. Let me know your thoughts. |
…ndency ShuffleManager implementations are currently not given type information for the key, value and combiner classes. Serialization of shuffle objects relies on objects being JavaSerializable, with methods defined for reading/writing the object or, alternatively, serialization via Kryo which uses reflection. Serialization systems like Avro, Thrift and Protobuf generate classes with zero argument constructors and explicit schema information (e.g. IndexedRecords in Avro have get, put and getSchema methods). By serializing the key, value and combiner class names in ShuffleDependency, shuffle implementations will have access to schema information when registerShuffle() is called.
41d2a3c to
ed1afacComparemassie
commented
Sep 9, 2015
I just rebased this on top of @rxin@andrewor14 This PR has been open for almost two months. Can you please let me know if you see any remaining work that needs to be done before merging? |
There was a problem hiding this comment.
The java doc should start with a description of what the method does. We should use the old one and add that it exists backward compatibility after the first sentence.
andrewor14
commented
Sep 9, 2015
@massie The changes here look fine. The only thing I'm still not sure about is the fact that everything is public. You pointed out that Other than that, I don't have strong opinions one way or the other about this patch. I think it's a good addition but I'm wary of the many public API changes in this patch. If @rxin thinks it's in a good shape then we should merge it. |
SparkQA
commented
Sep 9, 2015
Test build #42210 has finished for PR 7403 at commit
|
massie
commented
Sep 9, 2015
Thanks for the response, @andrewor14. I'll update this PR to make the class names private. As you say, we can make them public in a future PR, if needed. You're right that #7265 doesn't need them to be |
SparkQA
commented
Sep 10, 2015
Test build #42220 has finished for PR 7403 at commit
|
massie
commented
Sep 10, 2015
The class names are To provide a little more explanation of why the classPlaySuiteextendsSparkFunSuite {
defcombine[C](c: C):Unit= {
println("Running combine without ClassTag")
}
defcombine[C](c: C)(implicitct: ClassTag[C]):Unit= {
println("Running combin with ClassTag")
}
test("Example") {
combine(42)
}
}Causes the compiler to throw the error: There's unfortunately no way to add ClassTags and not break compatibility without have these new methods. I hope that you find this PR is ready to merge now. Please let me know if you see anything else that needs to be done. |
andrewor14
commented
Sep 10, 2015
@massie This looks OK to me. The only thing is that I find the name I understand that it won't compile if you just call it I'll defer the judgment to @rxin. |
massie
commented
Sep 10, 2015
@andrewor14 I agree the name We can't make the I hope that in Spark 2.0, when we're able to fix this API, we can simply add the |
rxin
commented
Sep 10, 2015
Let's add an experimental annotation to it, and then merge this. |
SparkQA
commented
Sep 10, 2015
Test build #42297 has finished for PR 7403 at commit
|
rxin
commented
Sep 11, 2015
LGTM. |
rxin
commented
Sep 11, 2015
I've merged this. Thanks @massie |
ShuffleManager implementations are currently not given type information for
the key, value and combiner classes. Serialization of shuffle objects relies
on objects being JavaSerializable, with methods defined for reading/writing
the object or, alternatively, serialization via Kryo which uses reflection.
Serialization systems like Avro, Thrift and Protobuf generate classes with
zero argument constructors and explicit schema information
(e.g. IndexedRecords in Avro have get, put and getSchema methods).
By serializing the key, value and combiner class names in ShuffleDependency,
shuffle implementations will have access to schema information when
registerShuffle() is called.