Pair<List<ASTNode>, List<Long>> getGroupByGroupingSetsForClause(
    QBParseInfo parseInfo, String dest) throws SemanticException {
    List<Long> groupingSets = new ArrayList<Long>();
    List<ASTNode> groupByExprs = getGroupByForClause(parseInfo, dest);

    if (parseInfo.getDestRollups().contains(dest)) {
      groupingSets = getGroupingSetsForRollup(groupByExprs.size());
    } else if (parseInfo.getDestCubes().contains(dest)) {
      groupingSets = getGroupingSetsForCube(groupByExprs.size());
    } else if (parseInfo.getDestGroupingSets().contains(dest)) {
      groupingSets = getGroupingSets(groupByExprs, parseInfo, dest);
    }

    if (!groupingSets.isEmpty() && groupByExprs.size() > Long.SIZE) {
      throw new SemanticException(ErrorMsg.HIVE_GROUPING_SETS_SIZE_LIMIT.getMsg());
    }

    return Pair.of(groupByExprs, groupingSets);
  }
create a filter plan. The condition and the inputs are specified.

@param qb
         current query block
@param condn
         The condition to be resolved
@param input
         the input operator
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java