title: Alternate to CROSS Join in Pig
body: <p>I have situation wherein I need to combine two datasets. Here are those</p>
  
  <pre><code>-- Dataset 1
  Date         Count
  2014-12-01      5
  2014-11-01      3
  
  -- Dataset 2
  Date          Col1     Col2     Col3
  2014-12-05    cv11     cv12     cv13
  2014-12-01    cv21     cv22     cv23
  2014-11-30    cv31     cv32     cv33
  2014-11-01    cv41     cv42     cv43
  2014-10-15    cv51     cv52     cv53
  </code></pre>
  
  <p>Now, what I need to do is place the count in dataset where if the date matches in both the sets, then the corresponding count value will be taken. Otherwise, the value which is contained by the lower date needs to be generated (I am really sorry if I am not able to phrase the question correctly. Please feel free to edit to make it clearer)</p>
  
  <p>Essentially, here is the output which I am looking for. If you see, till <code>2014-12-01</code>, the count was 3 and hence all dates which are available in our dataset2, will generate count as 3 and all dates post <code>2014-12-01</code> will generate a value of 5 in the count column.</p>
  
  <pre><code>-- Output
  Date          Col1     Col2     Col3   Count
  2014-12-05    cv11     cv12     cv13      5
  2014-12-01    cv21     cv22     cv23      5
  2014-11-30    cv31     cv32     cv33      3
  2014-11-01    cv41     cv42     cv43      3
  2014-10-15    cv51     cv52     cv53      3
  </code></pre>
  
  <p>I was trying to do the same using <code>CROSS</code> join, but that is causing my job to take hours as both the datasets are pretty large in size. Dataset1(~500K) and Dataset2(~5Million).</p>
  
  <p>Because, both the datasets are pretty bulky, CROSS isn't sufficing the case.</p>
  
  <p>Is there anything else which can be done?</p>