-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-7311] Introduce internal Serializer API for determining if serializers support object relocation #5924
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
Changes from 1 commit
b9624ee
86d4dcd
450fa21
0ba75e6
2c1233a
4aa61b2
123b992
0a7ebd7
50a68ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ import java.nio.ByteBuffer | |
| import scala.reflect.ClassTag | ||
|
|
||
| import org.apache.spark.{SparkConf, SparkEnv} | ||
| import org.apache.spark.annotation.{Experimental, DeveloperApi} | ||
| import org.apache.spark.annotation.{Private, Experimental, DeveloperApi} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: alphabetize
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Argh, I really need to fix my IntelliJ settings. I switched versions and didn't port all of my import sorting settings over, so stuff like this keeps happening :( |
||
| import org.apache.spark.util.{Utils, ByteBufferInputStream, NextIterator} | ||
|
|
||
| /** | ||
|
|
@@ -65,28 +65,36 @@ abstract class Serializer { | |
| def newInstance(): SerializerInstance | ||
|
|
||
| /** | ||
| * :: Private :: | ||
| * Returns true if this serializer supports relocation of its serialized objects and false | ||
| * otherwise. This should return true if and only if reordering the bytes of serialized objects | ||
| * in serialization stream output results in re-ordered input that can be read with the | ||
| * deserializer. For instance, the following should work if the serializer supports relocation: | ||
| * otherwise. This should return true if and only if reordering the bytes of serialized objects | ||
| * in serialization stream output is equivalent to having re-ordered those elements prior to | ||
| * serializing them. More specifically, the following should hold if a serializer supports | ||
| * relocation: | ||
| * | ||
| * serOut.open() | ||
| * position = 0 | ||
| * serOut.write(obj1) | ||
| * serOut.flush() | ||
| * position = # of bytes writen to stream so far | ||
| * obj1Bytes = [bytes 0 through position of stream] | ||
| * serOut.write(obj2) | ||
| * serOut.flush | ||
| * position2 = # of bytes written to stream so far | ||
| * obj2Bytes = bytes[position through position2 of stream] | ||
| * {{{ | ||
| * serOut.open() | ||
| * position = 0 | ||
| * serOut.write(obj1) | ||
| * serOut.flush() | ||
| * position = # of bytes writen to stream so far | ||
| * obj1Bytes = output[0:position-1] | ||
| * serOut.write(obj2) | ||
| * serOut.flush() | ||
| * position2 = # of bytes written to stream so far | ||
| * obj2Bytes = output[position:position2-1] | ||
| * serIn.open([obj2bytes] concatenate [obj1bytes]) should return (obj2, obj1) | ||
| * }}} | ||
| * | ||
| * serIn.open([obj2bytes] concatenate [obj1bytes]) should return (obj2, obj1) | ||
| * In general, this property should hold for serializers that are stateless. | ||
| * | ||
| * See SPARK-7311 for more discussion. | ||
| * This API is private to Spark; this method should not be overridden in third-party subclasses | ||
| * or called in user code and is subject to removal in future Spark releases. | ||
| * | ||
| * See SPARK-7311 for more details. | ||
| */ | ||
| @Experimental | ||
| def supportsRelocationOfSerializedObjects: Boolean = false | ||
| @Private | ||
|
||
| private[spark] def supportsRelocationOfSerializedObjects: Boolean = false | ||
|
||
| } | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this say "auto-reset" instead of "auto-flush"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; good catch.