public void removeBlock(QueryBlock block) { queryBlocks.remove(block.getName()); List<Integer> tobeRemoved = new ArrayList<>(); for (Map.Entry<Integer, QueryBlock> entry : queryBlockByPID.entrySet()) { tobeRemoved.add(entry.getKey()); } for (Integer rn : tobeRemoved) { queryBlockByPID.remove(rn); } }
public void removeBlock(QueryBlock block) { queryBlocks.remove(block.getName()); List<Integer> tobeRemoved = new ArrayList<Integer>(); for (Map.Entry<Integer, QueryBlock> entry : queryBlockByPID.entrySet()) { tobeRemoved.add(entry.getKey()); } for (Integer rn : tobeRemoved) { queryBlockByPID.remove(rn); } }
public List<QueryBlock> getChildBlocks(QueryBlock block) { List<QueryBlock> childBlocks = new ArrayList<>(); for (String blockName : queryBlockGraph.getChilds(block.getName())) { childBlocks.add(queryBlocks.get(blockName)); } return childBlocks; }
@Override public LogicalNode visitUnion(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, UnionNode node, Stack<LogicalNode> stack) throws TajoException { LogicalPlan.QueryBlock leftBlock = plan.getBlock(node.getLeftChild()); LogicalPlan.QueryBlock rightBlock = plan.getBlock(node.getRightChild()); Context leftContext = new Context(plan, PlannerUtil.toQualifiedFieldNames(context.requiredSet, leftBlock.getName())); Context rightContext = new Context(plan, PlannerUtil.toQualifiedFieldNames(context.requiredSet, rightBlock.getName())); stack.push(node); visit(leftContext, plan, leftBlock, leftBlock.getRoot(), new Stack<>()); visit(rightContext, plan, rightBlock, rightBlock.getRoot(), new Stack<>()); stack.pop(); return node; }
public LogicalNode optimize(OverridableConf context, LogicalPlan plan) throws TajoException { rulesBeforeJoinOpt.rewrite(new LogicalPlanRewriteRuleContext(context, plan, catalog, storage)); DirectedGraphCursor<String, BlockEdge> blockCursor = new DirectedGraphCursor<>(plan.getQueryBlockGraph(), plan.getRootBlock().getName()); if (context == null || context.getBool(SessionVars.TEST_JOIN_OPT_ENABLED)) { // default is true while (blockCursor.hasNext()) { optimizeJoinOrder(plan, blockCursor.nextBlock()); } } else { LOG.info("Skip join order optimization"); } rulesAfterToJoinOpt.rewrite(new LogicalPlanRewriteRuleContext(context, plan, catalog, storage)); return plan.getRootBlock().getRoot(); }
@Override public LogicalNode visitUnion(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, UnionNode node, Stack<LogicalNode> stack) throws TajoException { LogicalPlan.QueryBlock leftBlock = plan.getBlock(node.getLeftChild()); LogicalPlan.QueryBlock rightBlock = plan.getBlock(node.getRightChild()); Context leftContext = new Context(plan, PlannerUtil.toQualifiedFieldNames(context.requiredSet, leftBlock.getName())); Context rightContext = new Context(plan, PlannerUtil.toQualifiedFieldNames(context.requiredSet, rightBlock.getName())); stack.push(node); visit(leftContext, plan, leftBlock, leftBlock.getRoot(), new Stack<LogicalNode>()); visit(rightContext, plan, rightBlock, rightBlock.getRoot(), new Stack<LogicalNode>()); stack.pop(); return node; }
public QueryBlock getParentBlock(QueryBlock block) { return queryBlocks.get(queryBlockGraph.getParent(block.getName(), 0)); }
public LogicalNode optimize(OverridableConf context, LogicalPlan plan) throws TajoException { rulesBeforeJoinOpt.rewrite(new LogicalPlanRewriteRuleContext(context, plan, catalog, storage)); DirectedGraphCursor<String, BlockEdge> blockCursor = new DirectedGraphCursor<String, BlockEdge>(plan.getQueryBlockGraph(), plan.getRootBlock().getName()); if (context == null || context.getBool(SessionVars.TEST_JOIN_OPT_ENABLED)) { // default is true while (blockCursor.hasNext()) { optimizeJoinOrder(plan, blockCursor.nextBlock()); } } else { LOG.info("Skip join order optimization"); } rulesAfterToJoinOpt.rewrite(new LogicalPlanRewriteRuleContext(context, plan, catalog, storage)); return plan.getRootBlock().getRoot(); }
public QueryBlock getParentBlock(QueryBlock block) { return queryBlocks.get(queryBlockGraph.getParent(block.getName(), 0)); }
@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 void preHook(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, Expr expr) throws TajoException { ctx.getQueryBlock().setAlgebraicExpr(expr); ctx.getPlan().mapExprToBlock(expr, ctx.getQueryBlock().getName()); }
public String toString() { return "block=" + queryBlock.getName() + ", relNum=" + queryBlock.getRelations().size() + ", "+ queryBlock.namedExprsMgr.toString(); }
public String toString() { return "block=" + queryBlock.getName() + ", relNum=" + queryBlock.getRelations().size() + ", "+ queryBlock.namedExprsMgr.toString(); }
public List<QueryBlock> getChildBlocks(QueryBlock block) { List<QueryBlock> childBlocks = TUtil.newList(); for (String blockName : queryBlockGraph.getChilds(block.getName())) { childBlocks.add(queryBlocks.get(blockName)); } return childBlocks; }