private static <T> T deserializeObjectByKryo(Kryo kryo, InputStream in, Class<T> clazz ) {
    Input inp = new Input(in);
    kryo.setClassLoader(Utilities.getSessionSpecifiedClassLoader());
    T t = kryo.readObject(inp,clazz);
    inp.close();
    return t;
  }
@param plan Usually of type MapredWork, MapredLocalWork etc.
@param out stream in which serialized plan is written into
ql/src/java/org/apache/hadoop/hive/ql/exec/SerializationUtilities.java