private static void loadData() throws Exception {
    // sales.txt will need to be added as a resource.
    File file = new File("./sales.txt");
    BufferedReader br = new BufferedReader(new FileReader(file));
    data = new HashMap<String, Integer>();
    String line = br.readLine();
    while (line != null) {
      String[] parts = line.split("\t", 2);
      if (parts.length == 2) {
        data.put(parts[0], Integer.valueOf(parts[1]));
      }
      line = br.readLine();
    }
    br.close();
  }
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