Exemplo n.º 1
0
  @SuppressWarnings({"unchecked", "RedundantCast"})
  private static Class<? extends InputFormat<?, ?>> getInputFormatClass(
      JobConf conf, String inputFormatName) throws ClassNotFoundException {
    // CDH uses different names for Parquet
    if ("parquet.hive.DeprecatedParquetInputFormat".equals(inputFormatName)
        || "parquet.hive.MapredParquetInputFormat".equals(inputFormatName)) {
      return MapredParquetInputFormat.class;
    }

    Class<?> clazz = conf.getClassByName(inputFormatName);
    // TODO: remove redundant cast to Object after IDEA-118533 is fixed
    return (Class<? extends InputFormat<?, ?>>) (Object) clazz.asSubclass(InputFormat.class);
  }