/** * Get an instance of {@link HiveSerDeWrapper}. * * @param serDeType The SerDe type. If serDeType is one of the available {@link HiveSerDeWrapper.BuiltInHiveSerDe}, * the other three parameters are not used. Otherwise, serDeType should be the class name of a {@link SerDe}, * and the other three parameters must be present. */ public static HiveSerDeWrapper get(String serDeType, Optional<String> inputFormatClassName, Optional<String> outputFormatClassName) { Optional<BuiltInHiveSerDe> hiveSerDe = Enums.getIfPresent(BuiltInHiveSerDe.class, serDeType.toUpperCase()); if (hiveSerDe.isPresent()) { return new HiveSerDeWrapper(hiveSerDe.get()); } Preconditions.checkArgument(inputFormatClassName.isPresent(), "Missing input format class name for SerDe " + serDeType); Preconditions.checkArgument(outputFormatClassName.isPresent(), "Missing output format class name for SerDe " + serDeType); return new HiveSerDeWrapper(serDeType, inputFormatClassName.get(), outputFormatClassName.get()); }
/** * Get an instance of {@link HiveSerDeWrapper}. * * @param serDeType The SerDe type. If serDeType is one of the available {@link HiveSerDeWrapper.BuiltInHiveSerDe}, * the other three parameters are not used. Otherwise, serDeType should be the class name of a {@link SerDe}, * and the other three parameters must be present. */ public static HiveSerDeWrapper get(String serDeType, Optional<String> inputFormatClassName, Optional<String> outputFormatClassName) { Optional<BuiltInHiveSerDe> hiveSerDe = Enums.getIfPresent(BuiltInHiveSerDe.class, serDeType.toUpperCase()); if (hiveSerDe.isPresent()) { return new HiveSerDeWrapper(hiveSerDe.get()); } Preconditions.checkArgument(inputFormatClassName.isPresent(), "Missing input format class name for SerDe " + serDeType); Preconditions.checkArgument(outputFormatClassName.isPresent(), "Missing output format class name for SerDe " + serDeType); return new HiveSerDeWrapper(serDeType, inputFormatClassName.get(), outputFormatClassName.get()); }