// map-reduce jobs are not needed
// For eg: select count(1) from T where t.ds = ....
if (!optimizeMapAggrGroupBy(dest, qb)) {
// ////// Generate ReduceSink Operator
Operator reduceSinkOperatorInfo = genGroupByPlanReduceSinkOperator(qb,
dest, groupByOperatorInfo, (parseInfo
.getDistinctFuncExprsForClause(dest).isEmpty() ? -1
: Integer.MAX_VALUE), -1, true);
// ////// Generate GroupbyOperator for a partial aggregation
Operator groupByOperatorInfo2 = genGroupByPlanGroupByOperator1(parseInfo,
dest, reduceSinkOperatorInfo, GroupByDesc.Mode.PARTIALS,
genericUDAFEvaluators, false);
int numReducers = -1;
List<ASTNode> grpByExprs = getGroupByForClause(parseInfo, dest);
if (grpByExprs.isEmpty()) {
numReducers = 1;
}
// ////// Generate ReduceSinkOperator2
Operator reduceSinkOperatorInfo2 = genGroupByPlanReduceSinkOperator2MR(
parseInfo, dest, groupByOperatorInfo2, grpByExprs.size(), numReducers);
// ////// Generate GroupbyOperator3
return genGroupByPlanGroupByOperator2MR(parseInfo, dest,
reduceSinkOperatorInfo2, GroupByDesc.Mode.FINAL,
genericUDAFEvaluators);
} else {
// ////// Generate ReduceSink Operator
Operator reduceSinkOperatorInfo = genGroupByPlanReduceSinkOperator(qb,
dest, groupByOperatorInfo, getGroupByForClause(parseInfo, dest)
.size(), 1, true);
return genGroupByPlanGroupByOperator2MR(parseInfo, dest,
reduceSinkOperatorInfo, GroupByDesc.Mode.FINAL, genericUDAFEvaluators);