if (names.length < 2) {
return null;
}
if (!verifyTablePartition) {
return new HiveLockObject(names, data);
}
// do not throw exception if table does not exist
Table tab = db.getTable(names[0], names[1], false);
if (tab == null) {
return null;
}
if (names.length == 2) {
return new HiveLockObject(tab, data);
}
Map<String, String> partSpec = new HashMap<String, String>();
for (indx = 2; indx < names.length; indx++) {
String[] partVals = names[indx].split("=");
partSpec.put(partVals[0], partVals[1]);
}
Partition partn;
try {
partn = db.getPartition(tab, partSpec, false);
} catch (HiveException e) {
partn = null;
}
if (partn == null) {
return new HiveLockObject(new DummyPartition(tab, path, partSpec), data);
}
return new HiveLockObject(partn, data);
} catch (Exception e) {
LOG.error("Failed to create ZooKeeper object: " + e);
throw new LockException(e);
}
}