private Table createTableLikeTable(Table table, Map<String, String> originalProperties)
      throws SemanticException, HiveException {
    String[] names = Utilities.getDbTableName(desc.getTableName());
    table.setDbName(names[0]);
    table.setTableName(names[1]);
    table.setOwner(SessionState.getUserFromAuthenticator());

    setUserSpecifiedLocation(table);

    setTableParameters(table, originalProperties);

    if (desc.isUserStorageFormat() || (table.getInputFormatClass() == null) || (table.getOutputFormatClass() == null)) {
      setStorage(table);
    }

    table.getTTable().setTemporary(desc.isTemporary());
    table.getTTable().unsetId();

    if (desc.isExternal()) {
      setExternalProperties(table);
    } else {
      table.getParameters().remove("EXTERNAL");
      table.setTableType(TableType.MANAGED_TABLE);
    }

    return table;
  }
Operation process of creating a table like an existing one.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/like/CreateTableLikeOperation.java