use of org.apache.hadoop.hive.hbase.struct.AvroHBaseValueFactory in project hive by apache.
the class HBaseSerDeParameters method createValueFactories.
private List<HBaseValueFactory> createValueFactories(Configuration conf, Properties tbl) throws SerDeException {
List<HBaseValueFactory> valueFactories = new ArrayList<HBaseValueFactory>();
try {
for (int i = 0; i < columnMappings.size(); i++) {
String serType = getSerializationType(conf, tbl, columnMappings.getColumnsMapping()[i]);
if (AVRO_SERIALIZATION_TYPE.equals(serType)) {
Schema schema = getSchema(conf, tbl, columnMappings.getColumnsMapping()[i]);
valueFactories.add(new AvroHBaseValueFactory(i, schema));
} else if (STRUCT_SERIALIZATION_TYPE.equals(serType)) {
String structValueClassName = tbl.getProperty(HBaseSerDe.HBASE_STRUCT_SERIALIZER_CLASS);
if (structValueClassName == null) {
throw new IllegalArgumentException(HBaseSerDe.HBASE_STRUCT_SERIALIZER_CLASS + " must be set for hbase columns of type [" + STRUCT_SERIALIZATION_TYPE + "]");
}
Class<?> structValueClass = loadClass(structValueClassName, job);
valueFactories.add(new StructHBaseValueFactory(i, structValueClass));
} else {
valueFactories.add(new DefaultHBaseValueFactory(i));
}
}
} catch (Exception e) {
throw new SerDeException(e);
}
return valueFactories;
}
Aggregations