Skip to content

Commit 75af062

Browse files
committed
Add explicit return types
1 parent 04d3ae5 commit 75af062

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

graphx/src/main/scala/org/apache/spark/graphx/EdgeTriplet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ class EdgeTriplet[VD, ED] extends Edge[ED] {
6464

6565
override def toString = ((srcId, srcAttr), (dstId, dstAttr), attr).toString()
6666

67-
def toTuple = ((srcId, srcAttr), (dstId, dstAttr), attr)
67+
def toTuple: ((VertexId, VD), (VertexId, VD), ED) = ((srcId, srcAttr), (dstId, dstAttr), attr)
6868
}

graphx/src/main/scala/org/apache/spark/graphx/impl/Serializers.scala

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,28 @@ private[graphx]
2929
class RoutingTableMessageSerializer extends Serializer with Serializable {
3030
override def newInstance(): SerializerInstance = new ShuffleSerializerInstance {
3131

32-
override def serializeStream(s: OutputStream) = new ShuffleSerializationStream(s) {
33-
def writeObject[T](t: T) = {
34-
val msg = t.asInstanceOf[RoutingTableMessage]
35-
writeVarLong(msg.vid, optimizePositive = false)
36-
writeUnsignedVarInt(msg.pid)
37-
// TODO: Write only the bottom two bits of msg.position
38-
s.write(msg.position)
39-
this
32+
override def serializeStream(s: OutputStream): SerializationStream =
33+
new ShuffleSerializationStream(s) {
34+
def writeObject[T](t: T): SerializationStream = {
35+
val msg = t.asInstanceOf[RoutingTableMessage]
36+
writeVarLong(msg.vid, optimizePositive = false)
37+
writeUnsignedVarInt(msg.pid)
38+
// TODO: Write only the bottom two bits of msg.position
39+
s.write(msg.position)
40+
this
41+
}
4042
}
41-
}
4243

43-
override def deserializeStream(s: InputStream) = new ShuffleDeserializationStream(s) {
44-
override def readObject[T](): T = {
45-
val a = readVarLong(optimizePositive = false)
46-
val b = readUnsignedVarInt()
47-
val c = s.read()
48-
if (c == -1) throw new EOFException
49-
new RoutingTableMessage(a, b, c.toByte).asInstanceOf[T]
44+
override def deserializeStream(s: InputStream): DeserializationStream =
45+
new ShuffleDeserializationStream(s) {
46+
override def readObject[T](): T = {
47+
val a = readVarLong(optimizePositive = false)
48+
val b = readUnsignedVarInt()
49+
val c = s.read()
50+
if (c == -1) throw new EOFException
51+
new RoutingTableMessage(a, b, c.toByte).asInstanceOf[T]
52+
}
5053
}
51-
}
5254
}
5355
}
5456

0 commit comments

Comments
 (0)