Skip to content

Commit 710a21c

Browse files
author
Brennon York
committed
working diff given test case
1 parent aa57f83 commit 710a21c

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

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

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,32 @@ private[graphx] abstract class VertexPartitionBaseOps
9090

9191
/**
9292
* Hides vertices that are the same between this and other. For vertices that are different, keeps
93-
* the values from `other`. The indices of `this` and `other` must be the same.
93+
* the values from `other`.
9494
*/
9595
def diff(other: Self[VD]): Self[VD] = {
96-
if (self.index != other.index) {
97-
logWarning("Diffing two VertexPartitions with different indexes is slow.")
98-
diff(createUsingIndex(other.iterator))
99-
} else {
100-
val newMask = self.mask & other.mask
96+
// if (self.index != other.index) {
97+
// logWarning("Diffing two VertexPartitions with different indexes is slow.")
98+
// diff(createUsingIndex(other.iterator))
99+
// } else {
100+
// val newMask = self.mask & other.mask
101+
/* logInfo("NEWMASK START " + other.iterator.mkString + " AND " +
102+
self.iterator.mkString)
101103
var i = newMask.nextSetBit(0)
102104
while (i >= 0) {
103105
if (self.values(i) == other.values(i)) {
106+
logInfo("BEFORE i: " + i + " newMask: " + newMask.iterator.mkString +
107+
" sv " + self.values(i) + " ov " + other.values(i) + " om: " +
108+
other.mask.iterator.mkString + " selfm: " +
109+
self.mask.iterator.mkString)
104110
newMask.unset(i)
105111
}
106112
i = newMask.nextSetBit(i + 1)
107-
}
108-
this.withValues(other.values).withMask(newMask)
109-
}
113+
}*/
114+
this
115+
.withIndex(other.index)
116+
.withValues(other.values)
117+
.withMask((self.mask & other.mask) ^ other.mask)
118+
// }
110119
}
111120

112121
/** Left outer join another VertexPartition. */
@@ -172,7 +181,7 @@ private[graphx] abstract class VertexPartitionBaseOps
172181
val newMask = new BitSet(self.capacity)
173182
val newValues = new Array[VD2](self.capacity)
174183
iter.foreach { pair =>
175-
val pos = self.index.getPos(pair._1)
184+
var pos = self.index.getPos(pair._1)
176185
if (pos >= 0) {
177186
newMask.set(pos)
178187
newValues(pos) = pair._2

0 commit comments

Comments
 (0)