Expr expr = analyzer.parse(SORT_QUERY[0]);
LogicalPlan plan = planner.createPlan(LocalTajoTestingUtility.createDummySession(), expr);
LogicalNode rootNode = optimizer.optimize(plan);
PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);
PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);
ExternalSortExec sort = null;
if (exec instanceof ProjectionExec) {
ProjectionExec projExec = (ProjectionExec) exec;
sort = projExec.getChild();
} else if (exec instanceof ExternalSortExec) {
sort = (ExternalSortExec) exec;
} else {
assertTrue(false);
}
SortSpec[] sortSpecs = sort.getPlan().getSortKeys();
RangeShuffleFileWriteExec idxStoreExec = new RangeShuffleFileWriteExec(ctx, sm, sort, sort.getSchema(),
sort.getSchema(), sortSpecs);
exec = idxStoreExec;
exec.init();
exec.next();
exec.close();
Schema keySchema = PlannerUtil.sortSpecsToSchema(sortSpecs);
TupleComparator comp = new TupleComparator(keySchema, sortSpecs);
BSTIndex bst = new BSTIndex(conf);
BSTIndex.BSTIndexReader reader = bst.getIndexReader(