try {
Class sdclass = td.getDeserializerClass();
if(sdclass == null) {
String className = td.getSerdeClassName();
if ((className == "") || (className == null)) {
throw new HiveException("SerDe class or the SerDe class name is not set for table: " + td.getProperties().getProperty("name"));
}
sdclass = MapOperator.class.getClassLoader().loadClass(className);
}
deserializer = (Deserializer) sdclass.newInstance();
deserializer.initialize(hconf, p);
rowObjectInspector = (StructObjectInspector)deserializer.getObjectInspector();
// Next check if this table has partitions and if so
// get the list of partition names as well as allocate
// the serdes for the partition columns
String pcols = p.getProperty(org.apache.hadoop.hive.metastore.api.Constants.META_TABLE_PARTITION_COLUMNS);
if (pcols != null && pcols.length() > 0) {
partNames = new ArrayList<String>();
partValues = new ArrayList<String>();
partObjectInspectors = new ArrayList<ObjectInspector>();
String[] partKeys = pcols.trim().split("/");
for(String key: partKeys) {
partNames.add(key);
partValues.add(partSpec.get(key));
partObjectInspectors.add(
ObjectInspectorFactory.getStandardPrimitiveObjectInspector(String.class));
}
StructObjectInspector partObjectInspector = ObjectInspectorFactory.getStandardStructObjectInspector(partNames, partObjectInspectors);
rowWithPart = new Object[2];
rowWithPart[1] = partValues;
rowObjectInspector = ObjectInspectorFactory.getUnionStructObjectInspector(
Arrays.asList(new StructObjectInspector[]{
rowObjectInspector,
partObjectInspector}));
}
else {
partNames = null;
partValues = null;
}
LOG.info("Got partitions: " + pcols);
} catch (SerDeException e) {
e.printStackTrace();
throw new HiveException (e);
} catch (InstantiationException e) {
throw new HiveException (e);
} catch (IllegalAccessException e) {
throw new HiveException (e);
} catch (ClassNotFoundException e) {
throw new HiveException (e);
}
}
}
if(todo.size() == 0) {
// didn't find match for input file path in configuration!
// serious problem ..
LOG.error("Configuration does not have any alias for path: " + fpath.toUri().getPath());
throw new HiveException("Configuration and input path are inconsistent");
}
// we found all the operators that we are supposed to process. now bootstrap
this.setChildOperators(todo);
// the child operators may need the global mr configuration. set it now so