title: How to use string functions in pig
body: <p>I am trying to convert a string to upper case in pig using one of it's built-in functions. I am using pig in local mode.</p>
  
  <h1>emps.csv</h1>
  
  <pre><code>1,John,35,M,101,50000.00,03/03/79
  2,Jack,30,F,201,3540000.00,09/10/84
  </code></pre>
  
  <h1>Commands for loading data (WORKS FINE)</h1>
  
  <pre><code>empdata = load 'emps.csv'  using PigStorage(',') as (id:int,name:chararray,age:int,gender:chararray,deptId:int,sal:double);
  dump empdata
  </code></pre>
  
  <h1>Convert to upper case and print it (FAILS WITH ERROR)</h1>
  
  <pre><code>empnameucase = foreach empdata generate id,upper(name);
  </code></pre>
  
  <p>But I am getting following exception after executing above command:</p>
  
  <h1>Error Log:</h1>
  
  <pre><code>Caused by: org.apache.pig.backend.executionengine.ExecException: ERROR 1070: Could not resolve upper using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]
          at org.apache.pig.impl.PigContext.resolveClassName(PigContext.java:653)
          at org.apache.pig.impl.PigContext.getClassForAlias(PigContext.java:769)
          at org.apache.pig.parser.LogicalPlanBuilder.buildUDF(LogicalPlanBuilder.java:1491)
          ... 28 more
  </code></pre>
  
  <p>Please guide.</p>