@Override public void preHook(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, Expr expr) throws TajoException { ctx.getQueryBlock().setAlgebraicExpr(expr); ctx.getPlan().mapExprToBlock(expr, ctx.getQueryBlock().getName()); }
@Override public LogicalNode visitSetSession(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, SetSession expr) throws TajoException { SetSessionNode setSession = ctx.getPlan().createNode(SetSessionNode.class); return setSession; }
public static double computeCost(LogicalPlan plan, LogicalPlan.QueryBlock block) throws TajoException { CostContext costContext = new CostContext(); instance.visit(costContext, plan, block); return costContext.accumulatedCost; }
@Override public LogicalNode postHook(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, Expr expr, LogicalNode result) throws TajoException { // If non-from statement, result can be null. It avoids that case. if (result != null) { // setNode method registers each node to corresponding block and plan. ctx.getQueryBlock().registerNode(result); // It makes a map between an expr and a logical node. ctx.getQueryBlock().registerExprWithNode(expr, result); } return result; }
@Override public LogicalNode visitCreateDatabase(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, CreateDatabase expr) throws TajoException { CreateDatabaseNode createDatabaseNode = ctx.getPlan().createNode(CreateDatabaseNode.class); return createDatabaseNode; }
@Override public void preHook(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, Expr expr) throws TajoException { ctx.getQueryBlock().setAlgebraicExpr(expr); ctx.getPlan().mapExprToBlock(expr, ctx.getQueryBlock().getName()); }
@Override public LogicalNode postHook(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, Expr expr, LogicalNode result) throws TajoException { // If non-from statement, result can be null. It avoids that case. if (result != null) { // setNode method registers each node to corresponding block and plan. ctx.getQueryBlock().registerNode(result); // It makes a map between an expr and a logical node. ctx.getQueryBlock().registerExprWithNode(expr, result); } return result; }
public static double computeCost(LogicalPlan plan, LogicalPlan.QueryBlock block) throws TajoException { CostContext costContext = new CostContext(); instance.visit(costContext, plan, block); return costContext.accumulatedCost; }
@Override public LogicalNode visitDropDatabase(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, DropDatabase expr) throws TajoException { DropDatabaseNode dropDatabaseNode = ctx.getPlan().createNode(DropDatabaseNode.class); return dropDatabaseNode; }
@Override public LogicalNode visitAlterTable(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, AlterTable expr) throws TajoException { AlterTableNode alterTableNode = ctx.getPlan().createNode(AlterTableNode.class); return alterTableNode; }
@Override public LogicalNode visitDropDatabase(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, DropDatabase expr) throws TajoException { DropDatabaseNode dropDatabaseNode = ctx.getPlan().createNode(DropDatabaseNode.class); return dropDatabaseNode; }
@Override public LogicalNode visitSetSession(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, SetSession expr) throws TajoException { SetSessionNode setSession = ctx.getPlan().createNode(SetSessionNode.class); return setSession; }
@Override public LogicalNode visitCreateDatabase(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, CreateDatabase expr) throws TajoException { CreateDatabaseNode createDatabaseNode = ctx.getPlan().createNode(CreateDatabaseNode.class); return createDatabaseNode; }
@Override public LogicalNode visitDropTable(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, DropTable expr) throws TajoException { DropTableNode dropTable = ctx.getPlan().createNode(DropTableNode.class); return dropTable; }
@Override public LogicalNode visitAlterTablespace(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, AlterTablespace expr) throws TajoException { AlterTablespaceNode alterTablespace = ctx.getPlan().createNode(AlterTablespaceNode.class); return alterTablespace; }
public LogicalNode visitTruncateTable(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, TruncateTable expr) throws TajoException { TruncateTableNode truncateTableNode = ctx.getPlan().createNode(TruncateTableNode.class); return truncateTableNode; }
@Override public LogicalNode visitDropIndex(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, DropIndex expr) { return ctx.getPlan().createNode(DropIndexNode.class); }
@Override public LogicalNode visitDropTable(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, DropTable expr) throws TajoException { DropTableNode dropTable = ctx.getPlan().createNode(DropTableNode.class); return dropTable; }
@Override public LogicalNode visitAlterTable(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, AlterTable expr) throws TajoException { AlterTableNode alterTableNode = ctx.getPlan().createNode(AlterTableNode.class); return alterTableNode; }
@Override public LogicalNode visitAlterTablespace(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, AlterTablespace expr) throws TajoException { AlterTablespaceNode alterTablespace = ctx.getPlan().createNode(AlterTablespaceNode.class); return alterTablespace; }