title: Optimizing pig script
body: <p>I am trying to generate aggregated output. The issue is that all the data is going to a single reducer(Filter and Count are creating a problem). How can I optimize the following script?</p>
  
  <p>Expected output:
  group, 10,2,12,34...</p>
  
  <pre><code>data = LOAD '/input/useragents' USING PigStorage('\t') AS (Col1:chararray,Col2:chararray,Col3:chararray,col4:chararray,col5:chararray);
  
  grp1 = GROUP data BY  UA PARALLEL 50;
  fr1 = FOREACH grp1 {
          fltrCol1 = FILTER data BY Col1 == 'Other';
          fltrCol2 = FILTER data BY Col2 == 'Other';
          fltrCol3 = FILTER data BY Col3 == 'Other';
          fltrCol4 = FILTER data BY col4 == 'Other';
          fltrCol5 = FILTER data BY col5 == 'Other';
          cnt_fltrCol1 = COUNT(fltrCol1);
          cnt_fltrCol2 = COUNT(fltrCol2);
          cnt_fltrCol3 = COUNT(fltrCol3);
          cnt_fltrCol4 = COUNT(fltrCol4);
          cnt_fltrCol5 = COUNT(fltrCol5);
          GENERATE group,cnt_fltrCol1,cnt_fltrCol2,cnt_fltrCol3,cnt_fltrCol4,cnt_fltrCol5;
  } 
  </code></pre>