title: PIG need to find max
body: <p>I am new to Pig and working on a problem where I need to find the the player in this dataset with the max weight. Here is a sample of the data:</p>
  <pre><code>  id,     weight,id,year, triples
  (bayja01,210,bayja01,2005,6)
  (crawfca02,225,crawfca02,2005,15)
  (damonjo01,205,damonjo01,2005,6)
  (dejesda01,190,dejesda01,2005,6)
  (eckstda01,170,eckstda01,2005,7)
  </code></pre>
  <p>and here is my pig script:</p>
  <pre><code>batters = LOAD 'hdfs:/user/maria_dev/pigtest/Batting.csv' using PigStorage(',');
  realbatters = FILTER batters BY $1==2005;
  triphitters = FILTER realbatters BY $9&gt;5;
  tripids =  FOREACH triphitters GENERATE $0 AS id,$1 AS YEAR, $9 AS Trips;
  names = LOAD 'hdfs:/user/maria_dev/pigtest/Master.csv' 
  using PigStorage(',');
  weights = FOREACH names GENERATE $0 AS id, $16 AS weight;
  get_ids = JOIN  weights BY (id), tripids BY(id);
  wts  = FOREACH get_ids GENERATE MAX(get_ids.weight)as wgt;
  DUMP wts;
  </code></pre>
  <p>the second to last line did not work of course. It told me  I had to use an explicit cast. I have the filtering etc figured out - jsut can't figure out how to get the final answer.</p>