@Override
  public int execute() throws HiveException {
    Table oldview = context.getDb().getTable(desc.getViewName(), false);

    // replace existing view
    oldview.setViewOriginalText(desc.getOriginalText());
    oldview.setViewExpandedText(desc.getExpandedText());
    oldview.setFields(desc.getSchema());
    oldview.checkValidity(null);

    context.getDb().alterTable(desc.getViewName(), oldview, false, null, true);
    DDLUtils.addIfAbsentByName(new WriteEntity(oldview, WriteEntity.WriteType.DDL_NO_LOCK),
        context.getWork().getOutputs());

    return 0;
  }
Operation process of altering a view with a new query.
ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/AlterViewAsOperation.java