@Override
  public void createTableLike(String dbName, String existingTblName,
                String newTableName, boolean ifNotExists, boolean isExternal,
                String location) throws HCatException {

    Table hiveTable = getHiveTableLike(checkDB(dbName), existingTblName,
      newTableName, ifNotExists, location);
    if (hiveTable != null) {
      try {
        hmsClient.createTable(hiveTable);
      } catch (AlreadyExistsException e) {
        if (!ifNotExists) {
          throw new HCatException(
            "A table already exists with the name "
              + newTableName, e);
        }
      } catch (InvalidObjectException e) {
        throw new HCatException(
          "InvalidObjectException in create table like command.",
          e);
      } catch (MetaException e) {
        throw new HCatException(
          "MetaException in create table like command.", e);
      } catch (NoSuchObjectException e) {
        throw new ObjectNotFoundException(
          "NoSuchObjectException in create table like command.",
          e);
      } catch (TException e) {
        throw new ConnectionFailureException(
          "TException in create table like command.", 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