private static void createTable( HCatClient hcatClient, String dbName, String tblName, List<HCatFieldSchema> cols, List<HCatFieldSchema> partitionCols, String hdfsDir) throws HCatException { hcatClient.dropTable(dbName, tblName, true); hcatClient.createTable( HCatCreateTableDesc.create(dbName, tblName, cols) .partCols(partitionCols) .ifNotExists(true) .isTableExternal(true) .location(hdfsDir) .build()); }