Is there a simple way to count the number of elements of a dataset? At
the moment, I have to use the following code, which is pretty verbose
and unefficient.
val numVertices =
(srcVertices union targetVertices).distinct.reduceGroup { iter =>
var count = 1L
while (iter.hasNext) {
count += 1
iter.next
}
count
}
On Sat, Nov 22, 2014 at 8:09 PM, Sebastian Schelter <[hidden email]> wrote:
Hi,
Is there a simple way to count the number of elements of a dataset? At the moment, I have to use the following code, which is pretty verbose and unefficient.
val numVertices =
(srcVertices union targetVertices).distinct.reduceGroup { iter =>
var count = 1L
while (iter.hasNext) {
count += 1
iter.next
}
count
}
On Sat, Nov 22, 2014 at 8:09 PM, Sebastian Schelter <[hidden email]> wrote:
Hi,
Is there a simple way to count the number of elements of a dataset? At the moment, I have to use the following code, which is pretty verbose and unefficient.
val numVertices =
(srcVertices union targetVertices).distinct.reduceGroup { iter =>
var count = 1L
while (iter.hasNext) {
count += 1
iter.next
}
count
}