use of org.apache.hadoop.hive.serde2.DelimitedJSONSerDe in project SQLWindowing by hbutani.
the class QueryOutputPrinter method setupOutputSerDe.
private SerDe setupOutputSerDe(QueryDef qry, JobConf jcfg) throws WindowingException {
try {
// StructObjectInspector qOI = qry.getOutput().getOI();
// String cols = ObjectInspectorUtils.getFieldNames(qOI);
// String ctypes = ObjectInspectorUtils.getFieldTypes(qOI);
/* from FetchWork initialize */
String serdeName = HiveConf.getVar(jcfg, HiveConf.ConfVars.HIVEFETCHOUTPUTSERDE);
Class<? extends SerDe> serdeClass = Class.forName(serdeName, true, JavaUtils.getClassLoader()).asSubclass(SerDe.class);
SerDe serDe = (SerDe) ReflectionUtils.newInstance(serdeClass, null);
Properties serdeProp = new Properties();
// this is the default serialization format
if (serDe instanceof DelimitedJSONSerDe) {
serdeProp.put(Constants.SERIALIZATION_FORMAT, "" + Utilities.tabCode);
serdeProp.put(Constants.SERIALIZATION_NULL_FORMAT, "NULL");
}
serDe.initialize(jcfg, serdeProp);
return serDe;
} catch (Exception e) {
throw new WindowingException(e);
}
}
Aggregations