@Override
public int addPartitions(List<HCatAddPartitionDesc> partInfoList)
throws HCatException {
int numPartitions = -1;
if ((partInfoList == null) || (partInfoList.size() == 0)) {
throw new HCatException("The partition list is null or empty.");
}
Table tbl = null;
try {
tbl = hmsClient.getTable(partInfoList.get(0).getDatabaseName(),
partInfoList.get(0).getTableName());
ArrayList<Partition> ptnList = new ArrayList<Partition>();
for (HCatAddPartitionDesc desc : partInfoList) {
ptnList.add(desc.toHivePartition(tbl));
}
numPartitions = hmsClient.add_partitions(ptnList);
} catch (InvalidObjectException e) {
throw new HCatException(
"InvalidObjectException while adding partition.", e);
} catch (AlreadyExistsException e) {
throw new HCatException(
"AlreadyExistsException while adding partition.", e);
} catch (MetaException e) {
throw new HCatException("MetaException while adding partition.", e);
} catch (NoSuchObjectException e) {
throw new ObjectNotFoundException("The table "
+ partInfoList.get(0).getTableName()
+ " is could not be found.", e);
} catch (TException e) {