@Override
  protected void compilePlan(ParseContext pCtx) throws SemanticException{
    topOpsCopy = new HashMap<>();
    topOpsCopy = makeCopy(this.getTopOps(), this.getTopOps().getClass());
    super.compilePlan(pCtx);
  }
This method makes a copy of the given object by serialization/de-serialization
ql/src/java/org/apache/hadoop/hive/ql/parse/PrepareStatementAnalyzer.java