@@ -23,7 +23,7 @@ import java.nio.ByteBuffer
2323import scala .reflect .ClassTag
2424
2525import org .apache .spark .{SparkConf , SparkEnv }
26- import org .apache .spark .annotation .{Experimental , DeveloperApi }
26+ import org .apache .spark .annotation .{Private , Experimental , DeveloperApi }
2727import org .apache .spark .util .{Utils , ByteBufferInputStream , NextIterator }
2828
2929/**
@@ -65,28 +65,36 @@ abstract class Serializer {
6565 def newInstance (): SerializerInstance
6666
6767 /**
68+ * :: Private ::
6869 * Returns true if this serializer supports relocation of its serialized objects and false
69- * otherwise. This should return true if and only if reordering the bytes of serialized objects
70- * in serialization stream output results in re-ordered input that can be read with the
71- * deserializer. For instance, the following should work if the serializer supports relocation:
70+ * otherwise. This should return true if and only if reordering the bytes of serialized objects
71+ * in serialization stream output is equivalent to having re-ordered those elements prior to
72+ * serializing them. More specifically, the following should hold if a serializer supports
73+ * relocation:
7274 *
73- * serOut.open()
74- * position = 0
75- * serOut.write(obj1)
76- * serOut.flush()
77- * position = # of bytes writen to stream so far
78- * obj1Bytes = [bytes 0 through position of stream]
79- * serOut.write(obj2)
80- * serOut.flush
81- * position2 = # of bytes written to stream so far
82- * obj2Bytes = bytes[position through position2 of stream]
75+ * {{{
76+ * serOut.open()
77+ * position = 0
78+ * serOut.write(obj1)
79+ * serOut.flush()
80+ * position = # of bytes writen to stream so far
81+ * obj1Bytes = output[0:position-1]
82+ * serOut.write(obj2)
83+ * serOut.flush()
84+ * position2 = # of bytes written to stream so far
85+ * obj2Bytes = output[position:position2-1]
86+ * serIn.open([obj2bytes] concatenate [obj1bytes]) should return (obj2, obj1)
87+ * }}}
8388 *
84- * serIn.open([obj2bytes] concatenate [obj1bytes]) should return (obj2, obj1)
89+ * In general, this property should hold for serializers that are stateless.
8590 *
86- * See SPARK-7311 for more discussion.
91+ * This API is private to Spark; this method should not be overridden in third-party subclasses
92+ * or called in user code and is subject to removal in future Spark releases.
93+ *
94+ * See SPARK-7311 for more details.
8795 */
88- @ Experimental
89- def supportsRelocationOfSerializedObjects : Boolean = false
96+ @ Private
97+ private [spark] def supportsRelocationOfSerializedObjects : Boolean = false
9098}
9199
92100
0 commit comments