@Override public void dropTable(String dbName, String tableName, boolean ifExists) throws HCatException { try { hmsClient.dropTable(checkDB(dbName), tableName, true, ifExists); } catch (NoSuchObjectException e) { if (!ifExists) { throw new ObjectNotFoundException( "NoSuchObjectException while dropping table.", e); } } catch (MetaException e) { throw new HCatException("MetaException while dropping table.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while dropping table.", e); } }
@Override public List<HCatPartition> getPartitions(String dbName, String tblName) throws HCatException { List<HCatPartition> hcatPtns = new ArrayList<HCatPartition>(); try { HCatTable hcatTable = getTable(dbName, tblName); List<Partition> hivePtns = hmsClient.listPartitions( checkDB(dbName), tblName, (short) -1); for (Partition ptn : hivePtns) { hcatPtns.add(new HCatPartition(hcatTable, ptn)); } } catch (NoSuchObjectException e) { throw new ObjectNotFoundException( "NoSuchObjectException while retrieving partition.", e); } catch (MetaException e) { throw new HCatException( "MetaException while retrieving partition.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while retrieving partition.", e); } return hcatPtns; }
Partition hivePartition = hmsClient.getPartition(checkDB(dbName), tableName, ptnValues); if (hivePartition != null) {
@Override public void dropDatabase(String dbName, boolean ifExists, DropDBMode mode) throws HCatException { boolean isCascade = mode.toString().equalsIgnoreCase("cascade"); try { hmsClient.dropDatabase(checkDB(dbName), true, ifExists, isCascade); } catch (NoSuchObjectException e) { if (!ifExists) { throw new ObjectNotFoundException( "NoSuchObjectException while dropping db.", e); } } catch (InvalidOperationException e) { throw new HCatException( "InvalidOperationException while dropping db.", e); } catch (MetaException e) { throw new HCatException("MetaException while dropping db.", e); } catch (TException e) { throw new ConnectionFailureException("TException while dropping db.", e); } }
@Override public HCatDatabase getDatabase(String dbName) throws HCatException { HCatDatabase db = null; try { Database hiveDB = hmsClient.getDatabase(checkDB(dbName)); if (hiveDB != null) { db = new HCatDatabase(hiveDB); } } catch (NoSuchObjectException exp) { throw new ObjectNotFoundException( "NoSuchObjectException while fetching database", exp); } catch (MetaException exp) { throw new HCatException("MetaException while fetching database", exp); } catch (TException exp) { throw new ConnectionFailureException( "TException while fetching database", exp); } return db; }
@Override public HCatTable getTable(String dbName, String tableName) throws HCatException { HCatTable table = null; try { Table hiveTable = hmsClient.getTable(checkDB(dbName), tableName); if (hiveTable != null) { table = new HCatTable(hiveTable); } } catch (MetaException e) { throw new HCatException("MetaException while fetching table.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException( "NoSuchObjectException while fetching table.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while fetching table.", e); } return table; }
@Override public List<String> listTableNamesByPattern(String dbName, String tablePattern) throws HCatException { List<String> tableNames = null; try { tableNames = hmsClient.getTables(checkDB(dbName), tablePattern); } catch (MetaException e) { throw new HCatException("MetaException while fetching table names. " + e.getMessage(), e); } catch (UnknownDBException e) { throw new HCatException("UnknownDB " + dbName + " while fetching table names.", e); } catch (TException e) { throw new HCatException("Transport exception while fetching table names. " + e.getMessage(), e); } return tableNames; }
LOG.info("HCatClient dropPartitions(db=" + dbName + ",table=" + tableName + ", partitionSpec: ["+ partitionSpec + "])."); try { dbName = checkDB(dbName); Table table = hmsClient.getTable(dbName, tableName);
@Override public void markPartitionForEvent(String dbName, String tblName, Map<String, String> partKVs, PartitionEventType eventType) throws HCatException { try { hmsClient.markPartitionForEvent(checkDB(dbName), tblName, partKVs, eventType); } catch (MetaException e) { throw new HCatException( "MetaException while marking partition for event.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException( "NoSuchObjectException while marking partition for event.", e); } catch (UnknownTableException e) { throw new HCatException( "UnknownTableException while marking partition for event.", e); } catch (UnknownDBException e) { throw new HCatException( "UnknownDBException while marking partition for event.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while marking partition for event.", e); } }
@Override public boolean isPartitionMarkedForEvent(String dbName, String tblName, Map<String, String> partKVs, PartitionEventType eventType) throws HCatException { boolean isMarked = false; try { isMarked = hmsClient.isPartitionMarkedForEvent(checkDB(dbName), tblName, partKVs, eventType); } catch (MetaException e) { throw new HCatException( "MetaException while checking partition for event.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException( "NoSuchObjectException while checking partition for event.", e); } catch (UnknownTableException e) { throw new HCatException( "UnknownTableException while checking partition for event.", e); } catch (UnknownDBException e) { throw new HCatException( "UnknownDBException while checking partition for event.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while checking partition for event.", e); } return isMarked; }
String location) throws HCatException { Table hiveTable = getHiveTableLike(checkDB(dbName), existingTblName, newTableName, ifNotExists, location); if (hiveTable != null) {
Table newTable = null; try { oldtbl = hmsClient.getTable(checkDB(dbName), existingTblName); } catch (MetaException e1) { throw new HCatException(
@Override public void dropTable(String dbName, String tableName, boolean ifExists) throws HCatException { try { hmsClient.dropTable(checkDB(dbName), tableName, true, ifExists); } catch (NoSuchObjectException e) { if (!ifExists) { throw new ObjectNotFoundException( "NoSuchObjectException while dropping table.", e); } } catch (MetaException e) { throw new HCatException("MetaException while dropping table.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while dropping table.", e); } }
@Override public void dropTable(String dbName, String tableName, boolean ifExists) throws HCatException { try { hmsClient.dropTable(checkDB(dbName), tableName, true, ifExists); } catch (NoSuchObjectException e) { if (!ifExists) { throw new ObjectNotFoundException( "NoSuchObjectException while dropping table.", e); } } catch (MetaException e) { throw new HCatException("MetaException while dropping table.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while dropping table.", e); } }
@Override public void dropTable(String dbName, String tableName, boolean ifExists) throws HCatException { try { hmsClient.dropTable(checkDB(dbName), tableName, true, ifExists); } catch (NoSuchObjectException e) { if (!ifExists) { throw new ObjectNotFoundException( "NoSuchObjectException while dropping table.", e); } } catch (MetaException e) { throw new HCatException("MetaException while dropping table.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while dropping table.", e); } }
@Override public HCatDatabase getDatabase(String dbName) throws HCatException { HCatDatabase db = null; try { Database hiveDB = hmsClient.getDatabase(checkDB(dbName)); if (hiveDB != null) { db = new HCatDatabase(hiveDB); } } catch (NoSuchObjectException exp) { throw new ObjectNotFoundException( "NoSuchObjectException while fetching database", exp); } catch (MetaException exp) { throw new HCatException("MetaException while fetching database", exp); } catch (TException exp) { throw new ConnectionFailureException( "TException while fetching database", exp); } return db; }
@Override public List<String> listTableNamesByPattern(String dbName, String tablePattern) throws HCatException { List<String> tableNames = null; try { tableNames = hmsClient.getTables(checkDB(dbName), tablePattern); } catch (MetaException e) { throw new HCatException("MetaException while fetching table names. " + e.getMessage(), e); } catch (UnknownDBException e) { throw new HCatException("UnknownDB " + dbName + " while fetching table names.", e); } catch (TException e) { throw new HCatException("Transport exception while fetching table names. " + e.getMessage(), e); } return tableNames; }
@Override public List<String> listTableNamesByPattern(String dbName, String tablePattern) throws HCatException { List<String> tableNames = null; try { tableNames = hmsClient.getTables(checkDB(dbName), tablePattern); } catch (MetaException e) { throw new HCatException("MetaException while fetching table names. " + e.getMessage(), e); } catch (UnknownDBException e) { throw new HCatException("UnknownDB " + dbName + " while fetching table names.", e); } catch (TException e) { throw new HCatException("Transport exception while fetching table names. " + e.getMessage(), e); } return tableNames; }
@Override public List<String> listTableNamesByPattern(String dbName, String tablePattern) throws HCatException { List<String> tableNames = null; try { tableNames = hmsClient.getTables(checkDB(dbName), tablePattern); } catch (MetaException e) { throw new HCatException("MetaException while fetching table names. " + e.getMessage(), e); } catch (UnknownDBException e) { throw new HCatException("UnknownDB " + dbName + " while fetching table names.", e); } catch (TException e) { throw new HCatException("Transport exception while fetching table names. " + e.getMessage(), e); } return tableNames; }