title: Apache PIG - Create a new column based on another value
body: <p>I've a column (named Product) that is defined as Chararray that have three values: OT, AT and HP. I want to create a new column and transform this values in integer:</p>
  
  <ol>
  <li>OT = 1 </li>
  <li>AT = 2  </li>
  <li>HP = 3</li>
  </ol>
  
  <p>For that I create a foreach statment:</p>
  
  <pre><code>REGISTER '/usr/lib/pig/piggybank.jar';
  
  File = load '/user/cloudera/file.csv'  
      USING org.apache.pig.piggybank.storage.CSVExcelStorage(',')
        as (ID:Long, 
            Chain:Int,
            Dept:Int,
            Product_Measure:Chararray,
            Price:Double);
  
  
  Values = FOREACH File Generate
                              ID,
                                              Chain,
                                              Dept,
                                              ((Chararray)Product_Measure=='OT'?'1':(Chararray)Product_Measure=='AT'?'2':(Chararray)Product_Measure=='HP'?'3':'0') as Product_Measure,
                                              (Price&lt;0.1?0:Price) as Price;
  
  Filter_Values = FILTER Values BY  Price &gt; 0;
  
  DUMP  Filter_Values;
  </code></pre>
  
  <p>If remove the thrid line it works fine, so I think the problem is in when I try to convert the chararray in int.</p>
  
  <p>Can anyone help me?</p>
  
  <p>Thanks!</p>