public static List<FieldSchema> readSchemaFromFile(Configuration conf, String fileFormat, String filePath)
          throws HiveException {
    Class<AbstractSerDe> asClass = getSerde(conf, fileFormat);
    SchemaInference sd = (SchemaInference) ReflectionUtils.newInstance(asClass, conf);
    try {
      return sd.readSchema(conf, filePath);
    } catch (SerDeException e) {
      throw new HiveException(ErrorMsg.CTLF_FAILED_INFERENCE.getErrorCodedMsg(), e);
    }
  }
Returns a List containing FieldSchema as determined by the readSchema method of the provided file format.

@param conf Hadoop Configuration object used to look up class and provided to the readSchema method.
@param fileFormat File format in which to use SerDe from.
@param filePath Path to the file to read.
@throws HiveException if unable to read the schema
ql/src/java/org/apache/hadoop/hive/ql/io/SchemaInferenceUtils.java