public IntWritable evaluate(Text s) throws Exception {
    if (data == null) {
      loadData();
    }
    Integer val = data.get(s.toString());
    if (val == null) {
      return null;
    }
    result.set(val.intValue());
    return result;
  }
A UDF for testing, which does key/value lookup from a file
itests/util/src/main/java/org/apache/hadoop/hive/ql/udf/UDFFileLookup.java