PlanNode stageGroup = NodeFactory.getNewNode(NodeConstants.Types.GROUP);
planNode.addAsParent(stageGroup);
if (!stagedGroupingSymbols.isEmpty()) {
stageGroup.setProperty(NodeConstants.Info.GROUP_COLS, new ArrayList<SingleElementSymbol>(stagedGroupingSymbols));
stageGroup.addGroups(GroupsUsedByElementsVisitor.getGroups(stagedGroupingSymbols));
} else {
// if the source has no rows we need to insert a select node with criteria count(*)>0
PlanNode selectNode = NodeFactory.getNewNode(NodeConstants.Types.SELECT);
AggregateSymbol count = new AggregateSymbol("stagedAgg", NonReserved.COUNT, false, null); //$NON-NLS-1$
aggregates.add(count); //consider the count aggregate for the push down call below