# join(otherStream, \[numTasks])

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

When called on two DStreams of (K, V) and (K, W) pairs, return a new DStream of (K, (V, W)) pairs with all pairs of elements for each key.

```
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.apache.spark.streaming._
import org.apache.spark.streaming.StreamingContext._
import org.apache.log4j.{Level, Logger}

val conf = new SparkConf()
 .setMaster("local[2]").setAppName("NetworkWordCount")
sc.stop
val ssc = new StreamingContext(conf, Seconds(1))
import org.apache.spark.rdd.RDD
import scala.collection.mutable.Queue
val rddQueue = new Queue[RDD[(Int,Int)]]()
val inputStream = ssc.queueStream(rddQueue)
inputStream.join(inputStream)

/*
res4: org.apache.spark.streaming.dstream.DStream[(Int, (Int, Int))] = org.apache.spark.streaming.dstream.TransformedDStream@7296b9c6
*/
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://george-jen.gitbook.io/data-science-and-apache-spark/join-otherstream-numtasks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
