GroupbyNode groupByNode = PlannerUtil.findTopNode(rootNode, NodeType.GROUP_BY);
Enforcer enforcer = new Enforcer();
enforcer.enforceHashAggregation(groupByNode.getPID());
TaskAttemptContext ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan),
new Fragment[] {frags[0]}, workDir);
ctx.setEnforcer(enforcer);
PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);
PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);
exec.init();
exec.next();
exec.close();
assertTrue(exec instanceof HashAggregateExec);
context = analyzer.parse(QUERIES[7]);
plan = planner.createPlan(context);
optimizer.optimize(plan);
rootNode = plan.getRootBlock().getRoot();
groupByNode = PlannerUtil.findTopNode(rootNode, NodeType.GROUP_BY);
enforcer = new Enforcer();
enforcer.enforceSortAggregation(groupByNode.getPID(), null);
ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan),
new Fragment[] {frags[0]}, workDir);
ctx.setEnforcer(enforcer);
phyPlanner = new PhysicalPlannerImpl(conf,sm);
exec = phyPlanner.createPlan(ctx, rootNode);
exec.init();
exec.next();