title: Cartesian product of two RDD in Spark
body: <p>I am completely new to Apache Spark and I trying to Cartesian product two RDD. As an example I have A and B like :</p>
  
  <pre><code>A = {(a1,v1),(a2,v2),...}
  B = {(b1,s1),(b2,s2),...}
  </code></pre>
  
  <p>I need a new RDD like:</p>
  
  <pre><code>C = {((a1,v1),(b1,s1)), ((a1,v1),(b2,s2)), ...}
  </code></pre>
  
  <p>Any idea how I can do this? As simple as possible :)</p>
  
  <p>Thanks in advance</p>
  
  <p>PS: I finally did it like this as suggested by @Amit Kumar:</p>
  
  <p>cartesianProduct = A.cartesian(B)</p>