public LogicalNode getFound() { if (found == null) { throw new TajoInternalError("cannot find the parent of " + target.getPID()); } return this.found; }
@Override public LogicalNode visitGroupBy(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, GroupbyNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitGroupBy(context, plan, block, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildGroupBy(context, childBlock, node); context.execBlockMap.put(newExecBlock.getPlan().getPID(), newExecBlock); return newExecBlock.getPlan(); }
@Override public LogicalNode visitInsert(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock queryBlock, InsertNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitInsert(context, plan, queryBlock, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildStorePlan(context, childBlock, node); context.execBlockMap.put(node.getPID(), newExecBlock); return node; }
@Override public LogicalNode visitCreateTable(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock queryBlock, CreateTableNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitStoreTable(context, plan, queryBlock, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildStorePlan(context, childBlock, node); context.execBlockMap.put(node.getPID(), newExecBlock); return node; }
@Override public LogicalNode visitInsert(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock queryBlock, InsertNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitInsert(context, plan, queryBlock, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildStorePlan(context, childBlock, node); context.execBlockMap.put(node.getPID(), newExecBlock); return node; }
@Override public LogicalNode visitCreateTable(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock queryBlock, CreateTableNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitStoreTable(context, plan, queryBlock, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildStorePlan(context, childBlock, node); context.execBlockMap.put(node.getPID(), newExecBlock); return node; }
@Override public LogicalNode visitSort(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, SortNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitSort(context, plan, block, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildSortPlan(context, childBlock, node); context.execBlockMap.put(node.getPID(), newExecBlock); return node; }
@Override public LogicalNode visitStoreTable(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock queryBlock, StoreTableNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitStoreTable(context, plan, queryBlock, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildStorePlan(context, childBlock, node); context.execBlockMap.put(node.getPID(), newExecBlock); return node; }
@Override public LogicalNode visitWindowAgg(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, WindowAggNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitWindowAgg(context, plan, block, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildWindowAgg(context, childBlock, node); context.execBlockMap.put(newExecBlock.getPlan().getPID(), newExecBlock); return newExecBlock.getPlan(); }
@Override public LogicalNode visitWindowAgg(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, WindowAggNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitWindowAgg(context, plan, block, node, stack); ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); ExecutionBlock newExecBlock = buildWindowAgg(context, childBlock, node); context.execBlockMap.put(newExecBlock.getPlan().getPID(), newExecBlock); return newExecBlock.getPlan(); }
private int [] registerGetChildIds(SerializeContext context, LogicalNode node) { int [] childIds = new int[node.childNum()]; for (int i = 0; i < node.childNum(); i++) { if (node.getChild(i) != null && context.idMap.containsKey(node.getChild(i).getPID())) { childIds[i] = context.idMap.get(node.getChild(i).getPID()); } else { childIds[i] = context.seqId++; } } return childIds; } }
@Override public LogicalNode visitHaving(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, HavingNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitHaving(context, plan, block, node, stack); // Don't separate execution block. Having is pushed to the second grouping execution block. ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); node.setChild(childBlock.getPlan()); childBlock.setPlan(node); context.execBlockMap.put(node.getPID(), childBlock); return node; }
@Override public LogicalNode visitCreateIndex(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock queryBlock, CreateIndexNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitCreateIndex(context, plan, queryBlock, node, stack); // Don't separate execution block. CreateIndex is pushed to the first execution block. ExecutionBlock childBlock = context.execBlockMap.remove(child.getPID()); node.setChild(childBlock.getPlan()); childBlock.setPlan(node); context.execBlockMap.put(node.getPID(), childBlock); return node; } }
public static VerificationState verify(VerificationState state, LogicalNode currentNode, EvalNode expression) { instance.visit(state, expression, new Stack<EvalNode>()); Set<Column> referredColumns = EvalTreeUtil.findUniqueColumns(expression); for (Column referredColumn : referredColumns) { if (!currentNode.getInSchema().contains(referredColumn)) { throw new TajoInternalError("Invalid State: " + referredColumn + " cannot be accessible at Node (" + currentNode.getPID() + ")"); } } return state; }
public static VerificationState verify(VerificationState state, LogicalNode currentNode, EvalNode expression) { instance.visit(state, expression, new Stack<>()); Set<Column> referredColumns = EvalTreeUtil.findUniqueColumns(expression); for (Column referredColumn : referredColumns) { if (!currentNode.getInSchema().contains(referredColumn)) { throw new TajoInternalError("Invalid State: " + referredColumn + " cannot be accessible at Node (" + currentNode.getPID() + ")"); } } return state; }
@Override public LogicalNode visitFilter(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitFilter(context, plan, block, node, stack); ExecutionBlock execBlock = context.execBlockMap.remove(child.getPID()); node.setChild(execBlock.getPlan()); node.setInSchema(execBlock.getPlan().getOutSchema()); execBlock.setPlan(node); context.execBlockMap.put(node.getPID(), execBlock); return node; }
@Override public LogicalNode visitFilter(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitFilter(context, plan, block, node, stack); ExecutionBlock execBlock = context.execBlockMap.remove(child.getPID()); node.setChild(execBlock.getPlan()); node.setInSchema(execBlock.getPlan().getOutSchema()); execBlock.setPlan(node); context.execBlockMap.put(node.getPID(), execBlock); return node; }