title: Hive UDF - Error in the evaluate() Method
body: <p>I created the following Java class and added it to Hive after making a jar out of it</p>
  
  <pre><code>import org.apache.hadoop.hive.ql.exec.UDF;
  import org.apache.hadoop.io.Text;
  
  public class MakeCap extends UDF{
    private Text t;
  
    public Text evaluate(Text input){
      if(null==input){
        t.set("Invalid input");
      }else{
        t.set(input.toString().toUpperCase());
      }
      return t;
    }
  }
  </code></pre>
  
  <p>Next, I created a temporary function</p>
  
  <pre><code>CREATE TEMPORARY FUNCTION CAP AS 'com.iris.MakeCap';
  </code></pre>
  
  <p>But when I run </p>
  
  <pre><code>SELECT CAP('hello');
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Error: Error while compiling statement: FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments ''hello'': org.apache.hadoop.hive.ql.metadata.HiveException: 
  Unable to execute method public org.apache.hadoop.io.Text com.iris.MakeCap.evaluate(org.apache.hadoop.io.Text) 
  with arguments {hello}:null (state=42000,code=10014)
  </code></pre>
  
  <p>I tried to use <code>String</code> instead of <code>Text</code> as the argument type for <code>evaluate()</code> but got the same result. Then I also tried this</p>
  
  <pre><code>SELECT CAP(e.name) FROM default.emp e;
  </code></pre>
  
  <p>and got the same error. Could someone help me with this?</p>