Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created September 19, 2013 09:39
Show Gist options
  • Save mashiro/6621228 to your computer and use it in GitHub Desktop.
Save mashiro/6621228 to your computer and use it in GitHub Desktop.
val ids = new VIntArrayWritable
override def reduce(key: IntWritable, values: Iterable[VIntArrayWritable], context: Context): Unit = {
ids.set(values.map(_.toArray.asInstanceOf[Array[IntWritable]].toList).fold(Nil)(_ ++ _).distinct.toArray)
context.write(key, ids)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment