private RelNode genClusterByLogicalPlan(QB qb, Pair<RelNode, RowResolver> selPair,
        boolean outermostOB) throws SemanticException {
      QBParseInfo qbp = getQBParseInfo(qb);
      String dest = qbp.getClauseNames().iterator().next();
      ASTNode clusterByAST = qbp.getClusterByForClause(dest);

      if (clusterByAST == null) {
        return null;
      }

      return new OrderByRelBuilder(this, selPair, outermostOB)
              .addClusterBy(clusterByAST)
              .sortExchange();
    }
Generate OB RelNode and input Select RelNode that should be used to
introduce top constraining Project. If Input select RelNode is not
present then don't introduce top constraining select.

@param qb
@param selPair
@param outermostOB
@return RelNode OB RelNode
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java