public static void parseHiveHistory(String path, Listener l) throws IOException {
   if(path == null){
     return;
   }
   FileInputStream fi = new FileInputStream(path);
   BufferedReader reader = new BufferedReader(new InputStreamReader(fi));
   try {
     String line = null;
     StringBuilder buf = new StringBuilder();
     while ((line = reader.readLine()) != null) {
       buf.append(line);
       // if it does not end with " then it is line continuation
       if (!line.trim().endsWith("\"")) {
         continue;
       }
       parseLine(buf.toString(), l);
       buf = new StringBuilder();
     }
   } finally {
     try {
       reader.close();
     } catch (IOException ex) {
     }
   }
 }
Parses history file and calls call back functions. Also look at
 HiveHistoryViewer

@param path
@param l
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/history/HiveHistoryUtil.java