private static boolean dbExists(HCatClient client, final String database) throws Exception { try { HCatDatabase db = client.getDatabase(database); return db != null; } catch (ObjectNotFoundException e) { System.out.println(e.getMessage()); return false; } catch (HCatException e) { throw new Exception("Exception checking if the db exists:" + e.getMessage(), e); } }
private static boolean tableExists( HCatClient client, final String database, final String tableName) throws Exception { try { HCatTable table = client.getTable(database, tableName); return table != null; } catch (ObjectNotFoundException e) { System.out.println(e.getMessage()); return false; } catch (HCatException e) { throw new Exception("Exception checking if the table exists:" + e.getMessage(), e); } }