title: Join of two datasets in Mapreduce/Hadoop
body: <p>Does anyone know how to implement the Natural-Join operation between two datasets in Hadoop?</p>
  
  <p>More specifically, here's what I exactly need to do: </p>
  
  <p>I am having two sets of data: </p>
  
  <ol>
  <li><p>point information which is stored as (tile_number, point_id:point_info) , this is a 1:n key-value pairs. This means for every tile_number, there might be several point_id:point_info</p></li>
  <li><p>Line information which is stored as (tile_number, line_id:line_info) , this is again a 1:m key-value pairs and for every tile_number, there might be more than one line_id:line_info</p></li>
  </ol>
  
  <p>As you can see the tile_numbers are the same between the two datasets. now what I really need is to join these two datasets based on each tile_number. In other words for every tile_number, we have n point_id:point_info and m line_id:line_info. What I want to do is to join all pairs of point_id:point_info with all pairs of line_id:line_info for every tile_number</p>
  
  <hr>
  
  <p>In order to clarify, here's an example:</p>
  
  <p>For point pairs:</p>
  
  <pre><code>(tile0, point0)
  (tile0, point1)
  (tile1, point1)
  (tile1, point2)
  </code></pre>
  
  <p>for line pairs:</p>
  
  <pre><code>(tile0, line0)
  (tile0, line1)
  (tile1, line2)
  (tile1, line3)
  </code></pre>
  
  <p>what I want is as following:</p>
  
  <p>for tile 0:</p>
  
  <pre><code> (tile0, point0:line0)
   (tile0, point0:line1)
   (tile0, point1:line0)
   (tile0, point1:line1)
  </code></pre>
  
  <p>for tile 1:</p>
  
  <pre><code> (tile1, point1:line2)
   (tile1, point1:line3)
   (tile1, point2:line2)
   (tile1, point2:line3)
  </code></pre>