optimizer.optimize(plan);
LogicalNode rootNode = plan.getRootBlock().getRoot();
SortNode sortNode = PlannerUtil.findTopNode(rootNode, NodeType.SORT);
Enforcer enforcer = new Enforcer();
enforcer.enforceSortAlgorithm(sortNode.getPID(), SortAlgorithm.IN_MEMORY_SORT);
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(((ProjectionExec)exec).getChild() instanceof MemSortExec);
context = analyzer.parse(SORT_QUERY[0]);
plan = planner.createPlan(context);
optimizer.optimize(plan);
rootNode = plan.getRootBlock().getRoot();
sortNode = PlannerUtil.findTopNode(rootNode, NodeType.SORT);
enforcer = new Enforcer();
enforcer.enforceSortAlgorithm(sortNode.getPID(), SortAlgorithm.MERGE_SORT);
ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan),
new Fragment[] {frags[0]}, workDir);
ctx.setEnforcer(enforcer);
phyPlanner = new PhysicalPlannerImpl(conf,sm);