@Override
  public void renameTable(String dbName, String oldName, String newName)
    throws HCatException {
    Table tbl;
    try {
      Table oldtbl = hmsClient.getTable(checkDB(dbName), oldName);
      if (oldtbl != null) {
        // TODO : Should be moved out.
        if (oldtbl
          .getParameters()
          .get(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE) != null) {
          throw new HCatException(
            "Cannot use rename command on a non-native table");
        }
        tbl = new Table(oldtbl);
        tbl.setTableName(newName);
        hmsClient.alter_table(checkDB(dbName), oldName, tbl);
      }
    } catch (MetaException e) {
      throw new HCatException("MetaException while renaming table", e);
    } catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while renaming table", e);
    } catch (InvalidOperationException e) {
      throw new HCatException(
        "InvalidOperationException while renaming table", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
          "TException while renaming table", e);
    }
  }
The HCatClientHMSImpl is the Hive Metastore client based implementation of
HCatClient.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java