private void setStorage(Table table) throws HiveException {
    table.setInputFormatClass(desc.getDefaultInputFormat());
    table.setOutputFormatClass(desc.getDefaultOutputFormat());
    table.getTTable().getSd().setInputFormat(table.getInputFormatClass().getName());
    table.getTTable().getSd().setOutputFormat(table.getOutputFormatClass().getName());
    if (table.getTTable().getSd().getSerdeInfo() != null &&
            table.getTTable().getSd().getSerdeInfo().getParameters() != null) {
      table.getTTable().getSd().getSerdeInfo().getParameters().clear();
    }
    if (desc.getDefaultSerName() == null) {
      LOG.info("Default to LazySimpleSerDe for table {}", desc.getTableName());
      table.setSerializationLib(LazySimpleSerDe.class.getName());
    } else {
      // let's validate that the serde exists
      DDLUtils.validateSerDe(desc.getDefaultSerName(), context);
      table.setSerializationLib(desc.getDefaultSerName());
    }
  }
Operation process of creating a table like an existing one.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/like/CreateTableLikeOperation.java