//For partitioned table, fail if partition is already present
List<String> currentParts = client.listPartitionNames(outputInfo.getDatabaseName(),
outputInfo.getTableName(), partitionValues, (short) 1);
if( currentParts.size() > 0 ) {
throw new HowlException(ErrorType.ERROR_DUPLICATE_PARTITION);
}
} else {
Path tablePath = new Path(table.getSd().getLocation());
FileSystem fs = tablePath.getFileSystem(job.getConfiguration());
if ( fs.exists(tablePath) ) {
FileStatus[] status = fs.globStatus(new Path(tablePath, "*"), hiddenFileFilter);
if( status.length > 0 ) {
throw new HowlException(ErrorType.ERROR_NON_EMPTY_TABLE,
table.getDbName() + "." + table.getTableName());
}
}
}
}