*/
private static class CheckGroupByProc implements NodeProcessor {
public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx ctx,
Object... nodeOutputs) throws SemanticException {
GroupByOperator operator = (GroupByOperator)nd;
canApplyCtx = (RewriteCanApplyCtx)ctx;
//for each group-by clause in query, only one GroupByOperator of the
//GBY-RS-GBY sequence is stored in getGroupOpToInputTables
//we need to process only this operator
//Also, we do not rewrite for cases when same query branch has multiple group-by constructs
if(canApplyCtx.getParseContext().getGroupOpToInputTables().containsKey(operator) &&
!canApplyCtx.isQueryHasGroupBy()){
canApplyCtx.setQueryHasGroupBy(true);
GroupByDesc conf = (GroupByDesc) operator.getConf();
List<AggregationDesc> aggrList = conf.getAggregators();
if(aggrList != null && aggrList.size() > 0){
for (AggregationDesc aggregationDesc : aggrList) {
canApplyCtx.setAggFuncCnt(canApplyCtx.getAggFuncCnt() + 1);
//In the current implementation, we do not support more than 1 agg funcs in group-by