Skip to content

Commit 57202e8

Browse files
committed
Replace case with pair parameter
1 parent 75af062 commit 57202e8

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ object RoutingTablePartition {
7676
edgePartition.dstIds.iterator.foreach { dstId =>
7777
map.changeValue(dstId, 0x2, (b: Byte) => (b | 0x2).toByte)
7878
}
79-
map.iterator.map { case (vid, position) => new RoutingTableMessage(vid, pid, position) }
79+
map.iterator.map { vidAndPosition =>
80+
new RoutingTableMessage(vidAndPosition._1, pid, vidAndPosition._2)
81+
}
8082
}
8183

8284
/** Build a `RoutingTablePartition` from `RoutingTableMessage`s. */

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ private[graphx] object VertexPartitionBase {
3333
def initFrom[VD: ClassTag](iter: Iterator[(VertexId, VD)])
3434
: (VertexIdToIndexMap, Array[VD], BitSet) = {
3535
val map = new PrimitiveKeyOpenHashMap[VertexId, VD]
36-
iter.foreach { case (k, v) =>
37-
map(k) = v
36+
iter.foreach { pair =>
37+
map(pair._1) = pair._2
3838
}
3939
(map.keySet, map._values, map.keySet.getBitSet)
4040
}
@@ -46,8 +46,8 @@ private[graphx] object VertexPartitionBase {
4646
def initFrom[VD: ClassTag](iter: Iterator[(VertexId, VD)], mergeFunc: (VD, VD) => VD)
4747
: (VertexIdToIndexMap, Array[VD], BitSet) = {
4848
val map = new PrimitiveKeyOpenHashMap[VertexId, VD]
49-
iter.foreach { case (k, v) =>
50-
map.setMerge(k, v, mergeFunc)
49+
iter.foreach { pair =>
50+
map.setMerge(pair._1, pair._2, mergeFunc)
5151
}
5252
(map.keySet, map._values, map.keySet.getBitSet)
5353
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ private[graphx] abstract class VertexPartitionBaseOps
171171
: Self[VD2] = {
172172
val newMask = new BitSet(self.capacity)
173173
val newValues = new Array[VD2](self.capacity)
174-
iter.foreach { case (vid, vdata) =>
175-
val pos = self.index.getPos(vid)
174+
iter.foreach { pair =>
175+
val pos = self.index.getPos(pair._1)
176176
if (pos >= 0) {
177177
newMask.set(pos)
178-
newValues(pos) = vdata
178+
newValues(pos) = pair._2
179179
}
180180
}
181181
this.withValues(newValues).withMask(newMask)
@@ -189,11 +189,11 @@ private[graphx] abstract class VertexPartitionBaseOps
189189
val newMask = new BitSet(self.capacity)
190190
val newValues = new Array[VD](self.capacity)
191191
System.arraycopy(self.values, 0, newValues, 0, newValues.length)
192-
iter.foreach { case (vid, vdata) =>
193-
val pos = self.index.getPos(vid)
192+
iter.foreach { pair =>
193+
val pos = self.index.getPos(pair._1)
194194
if (pos >= 0) {
195195
newMask.set(pos)
196-
newValues(pos) = vdata
196+
newValues(pos) = pair._2
197197
}
198198
}
199199
this.withValues(newValues).withMask(newMask)

0 commit comments

Comments
 (0)