> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-and-apache-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-and-apache-spark/cogroup-otherstream-numtasks.md).

# cogroup(otherStream, \[numTasks])

### cogroup(otherStream, \[numTasks])

When called on a DStream of (K, V) and (K, W) pairs, return a new DStream of (K, (Seq\[V], Seq\[W])) tuples.

```
inputStream.cogroup(inputStream)

/*
res5: org.apache.spark.streaming.dstream.DStream[(Int, (Iterable[Int], Iterable[Int]))] = org.apache.spark.streaming.dstream.TransformedDStream@2423d020
*/
```
