Search in sources :

Example 1 with FetchFormatter

use of org.apache.hadoop.hive.serde2.FetchFormatter in project hive by apache.

the class ListSinkOperator method initializeFetcher.

private FetchFormatter initializeFetcher(Configuration conf) throws Exception {
    String formatterName = conf.get(SerDeUtils.LIST_SINK_OUTPUT_FORMATTER);
    FetchFormatter fetcher;
    if (formatterName != null && !formatterName.isEmpty()) {
        Class<? extends FetchFormatter> fetcherClass = Class.forName(formatterName, true, Utilities.getSessionSpecifiedClassLoader()).asSubclass(FetchFormatter.class);
        fetcher = ReflectionUtils.newInstance(fetcherClass, null);
    } else {
        fetcher = new DefaultFetchFormatter();
    }
    // selectively used by fetch formatter
    Properties props = new Properties();
    props.put(serdeConstants.SERIALIZATION_FORMAT, "" + Utilities.tabCode);
    props.put(serdeConstants.SERIALIZATION_NULL_FORMAT, getConf().getSerializationNullFormat());
    fetcher.initialize(conf, props);
    return fetcher;
}
Also used : DefaultFetchFormatter(org.apache.hadoop.hive.serde2.DefaultFetchFormatter) FetchFormatter(org.apache.hadoop.hive.serde2.FetchFormatter) DefaultFetchFormatter(org.apache.hadoop.hive.serde2.DefaultFetchFormatter) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)1 DefaultFetchFormatter (org.apache.hadoop.hive.serde2.DefaultFetchFormatter)1 FetchFormatter (org.apache.hadoop.hive.serde2.FetchFormatter)1