if (currentParts.size() > 0) {
// If a table is partitioned and immutable, then the presence
// of the partition alone is enough to throw an error - we do
// not need to check for emptiness to decide to throw an error
throw new HCatException(ErrorType.ERROR_DUPLICATE_PARTITION);
}
}
} else {
List<String> partitionValues = getPartitionValueList(
table, outputInfo.getPartitionValues());
// non-partitioned table
Path tablePath = new Path(table.getTTable().getSd().getLocation());
FileSystem fs = tablePath.getFileSystem(context.getConfiguration());
if (!MetaStoreUtils.isDirEmpty(fs,tablePath)){
throw new HCatException(ErrorType.ERROR_NON_EMPTY_TABLE,
table.getDbName() + "." + table.getTableName());
}
}
}