cogroup() function seems to return (K, (Iterable<V>, Iterable<W>)), rather than (K, Iterable<V>, Iterable<W>), as it is pointed out in the docs (at least for version 1.1.0):
https://spark.apache.org/docs/1.1.0/programming-guide.html <https://spark.apache.org/docs/1.1.0/programming-guide.html> This simple discrepancy costed to me half a day of debug and frustration. Kirill