@Override
  public RexNode visitSubQuery(RexSubQuery subQuery) {
    // Call the RelNode Shuttle to gather all the information within the RelNodes of the
    // RexSubQUery
    SubQueryRelNodeShuttle relShuttle = new SubQueryRelNodeShuttle(subQuery, notFlag);
    subQuery.rel.accept(relShuttle);
    correlationInfos.add(relShuttle.getCorrelationInfo());
    return subQuery;
  }
CorrelationIdVisitor digs out information from a given RexNode about all the RexSubQuery
RexNodes in the top layer. It does not go into RexSubQuery nodes within a RexSubQuery node.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/correlation/CorrelationInfoVisitor.java