@Override
  public void analyzeInternal(ASTNode root) throws SemanticException {
    ASTNode query = (ASTNode)(root.getChild(0));
    String queryName = getQueryName(root);

    // first compile the parameterized query
    super.analyzeInternal(query);

    // need to mark this as prepared query so that compiler later can skip running it
    // and skip initializing tasks etc.
    this.prepareQuery = true;

    //save the plan, skip saving for explain
    if (this.ctx.getExplainConfig() == null) {
      savePlan(queryName);
    }
  }
This method makes a copy of the given object by serialization/de-serialization
ql/src/java/org/apache/hadoop/hive/ql/parse/PrepareStatementAnalyzer.java