title: Apache PIG: apply LIMIT only if parameter is > 0
body: <p>How can I achieve the following in PIG, within a <code>foreach</code>:</p>
  
  <pre><code>REL = foreach RELS {
   if ( cnt == 0 )
   limited_result = NULL/Empty;
   else
   limited_result = LIMIT results cnt ;
  
   generate limited_result.some_field;
  }
  </code></pre>
  
  <p>I cannot use <code>LIMIT</code>, since it validates that the 'cnt' is bigger than 0;
  I've tried to use a <code>SPLIT</code>, but apparently it isn't supported within <code>foreach</code>.</p>