@Override
  public Object evaluate(DeferredObject[] arguments) throws HiveException {
    if (arguments[0].get() == null || arguments[1].get() == null) {
      return null;
    }

    Text subtext = (Text) converters[0].convert(arguments[0].get());
    Text text = (Text) converters[1].convert(arguments[1].get());
    int start = 1;
    if (arguments.length == 3) {
      IntWritable startWritable = (IntWritable) converters[2]
          .convert(arguments[2].get());
      if (startWritable == null) {
        intWritable.set(0);
        return intWritable;
      }
      start = startWritable.get();
    }
    intWritable.set(GenericUDFUtils.findText(text, subtext, start - 1) + 1);
    return intWritable;
  }
Generic UDF for string function <code>LOCATE(substr, str)</code>,
<code>LOCATE(substr, str, start)</code>. This mimcs the function from MySQL
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_locate

<pre>
usage:
LOCATE(substr, str)
LOCATE(substr, str, start)
</pre>
<p>
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java