@Override public LogicalNode visitFilter(Object context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode selNode, Stack<LogicalNode> stack) throws TajoException { selNode.setQual(evalRewriter.visit(null, selNode.getQual(), new Stack<EvalNode>())); return null; }
@Override public LogicalNode visitFilter(Object context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode selNode, Stack<LogicalNode> stack) throws TajoException { selNode.setQual(evalRewriter.visit(null, selNode.getQual(), new Stack<>())); return null; }
selNode.setQual(AlgebraicUtil.createSingletonExprFromCNF(matched.toArray(new EvalNode[matched.size()]))); context.pushingDownFilters.removeAll(matched);
selNode.setQual(AlgebraicUtil.createSingletonExprFromCNF(matched.toArray(new EvalNode[matched.size()]))); context.pushingDownFilters.removeAll(matched);
@Override public LogicalNode visitFilter(PlanShapeFixerContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, Stack<LogicalNode> stack) throws TajoException { super.visitFilter(context, plan, block, node, stack); if (node.hasQual()) { node.setQual(sortQual(node.getQual())); } return null; }
@Override public LogicalNode visitFilter(PlanShapeFixerContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, Stack<LogicalNode> stack) throws TajoException { super.visitFilter(context, plan, block, node, stack); if (node.hasQual()) { node.setQual(sortQual(node.getQual())); } return null; }
filters.addAll(new HashSet<>(Arrays.asList(AlgebraicUtil.toConjunctiveNormalFormArray(topParentSelect.getQual())))); filters.addAll(remainingQuals); topParentSelect.setQual(AlgebraicUtil.createSingletonExprFromCNF( filters.toArray(new EvalNode[filters.size()]))); return newJoinNode; } else { SelectionNode newSelection = plan.createNode(SelectionNode.class); newSelection.setQual(AlgebraicUtil.createSingletonExprFromCNF( remainingQuals.toArray(new EvalNode[remainingQuals.size()]))); newSelection.setChild(newJoinNode);
selectionNode.setInSchema(childNode.getOutSchema()); selectionNode.setOutSchema(childNode.getOutSchema()); selectionNode.setQual(qual); block.registerNode(selectionNode);
filters.addAll(TUtil.newHashSet(AlgebraicUtil.toConjunctiveNormalFormArray(topParentSelect.getQual()))); filters.addAll(remainingQuals); topParentSelect.setQual(AlgebraicUtil.createSingletonExprFromCNF( filters.toArray(new EvalNode[filters.size()]))); return newJoinNode; } else { SelectionNode newSelection = plan.createNode(SelectionNode.class); newSelection.setQual(AlgebraicUtil.createSingletonExprFromCNF( remainingQuals.toArray(new EvalNode[remainingQuals.size()]))); newSelection.setChild(newJoinNode);
selectionNode.setInSchema(childNode.getOutSchema()); selectionNode.setOutSchema(childNode.getOutSchema()); selectionNode.setQual(qual); block.registerNode(selectionNode);
public LogicalNode visitFilter(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, Stack<LogicalNode> stack) throws TajoException { Context newContext = new Context(context); String referenceName = newContext.targetListMgr.add(node.getQual()); newContext.addNecessaryReferences(node.getQual()); LogicalNode child = super.visitFilter(newContext, plan, block, node, stack); node.setInSchema(child.getOutSchema()); node.setOutSchema(child.getOutSchema()); Target target = context.targetListMgr.getTarget(referenceName); if (newContext.targetListMgr.isEvaluated(referenceName)) { node.setQual(new FieldEval(target.getNamedColumn())); } else { node.setQual(target.getEvalTree()); newContext.targetListMgr.markAsEvaluated(target); } return node; }
private static SelectionNode convertFilter(OverridableConf context, EvalContext evalContext, Map<Integer, LogicalNode> nodeMap, PlanProto.LogicalNode protoNode) { PlanProto.FilterNode filterProto = protoNode.getFilter(); SelectionNode selection = new SelectionNode(protoNode.getNodeId()); selection.setInSchema(convertSchema(protoNode.getInSchema())); selection.setOutSchema(convertSchema(protoNode.getOutSchema())); selection.setChild(nodeMap.get(filterProto.getChildSeq())); selection.setQual(EvalNodeDeserializer.deserialize(context, evalContext, filterProto.getQual())); return selection; }
public LogicalNode visitFilter(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, SelectionNode node, Stack<LogicalNode> stack) throws TajoException { Context newContext = new Context(context); String referenceName = newContext.targetListMgr.add(node.getQual()); newContext.addNecessaryReferences(node.getQual()); LogicalNode child = super.visitFilter(newContext, plan, block, node, stack); node.setInSchema(child.getOutSchema()); node.setOutSchema(child.getOutSchema()); Target target = context.targetListMgr.getTarget(referenceName); if (newContext.targetListMgr.isEvaluated(referenceName)) { node.setQual(new FieldEval(target.getNamedColumn())); } else { node.setQual(target.getEvalTree()); newContext.targetListMgr.markAsEvaluated(target); } return node; }
private static SelectionNode convertFilter(OverridableConf context, EvalContext evalContext, Map<Integer, LogicalNode> nodeMap, PlanProto.LogicalNode protoNode) { PlanProto.FilterNode filterProto = protoNode.getFilter(); SelectionNode selection = new SelectionNode(protoNode.getNodeId()); selection.setInSchema(convertSchema(protoNode.getInSchema())); selection.setOutSchema(convertSchema(protoNode.getOutSchema())); selection.setChild(nodeMap.get(filterProto.getChildSeq())); selection.setQual(EvalNodeDeserializer.deserialize(context, evalContext, filterProto.getQual())); return selection; }
EvalNode simplified = context.evalOptimizer.optimize(context, searchCondition); selectionNode.setQual(simplified);
EvalNode simplified = context.evalOptimizer.optimize(context, searchCondition); selectionNode.setQual(simplified);
node.setQual(AlgebraicUtil.createSingletonExprFromDNF(rewrittenDnfs.toArray(new EvalNode[rewrittenDnfs.size()])));
private SelectionNode createSelectionParentForNonEquiThetaJoinQuals(LogicalPlan plan, QueryBlock block, Stack<LogicalNode> stack, JoinNode joinNode, List<EvalNode> nonEquiThetaJoinQuals) { SelectionNode selectionNode = plan.createNode(SelectionNode.class); selectionNode.setInSchema(joinNode.getOutSchema()); selectionNode.setOutSchema(joinNode.getOutSchema()); selectionNode.setQual(AlgebraicUtil.createSingletonExprFromCNF(nonEquiThetaJoinQuals)); block.registerNode(selectionNode); LogicalNode parent = stack.peek(); if (parent instanceof UnaryNode) { ((UnaryNode) parent).setChild(selectionNode); } else if (parent instanceof BinaryNode) { BinaryNode binaryParent = (BinaryNode) parent; if (binaryParent.getLeftChild().getPID() == joinNode.getPID()) { binaryParent.setLeftChild(selectionNode); } else if (binaryParent.getRightChild().getPID() == joinNode.getPID()) { binaryParent.setRightChild(selectionNode); } } else if (parent instanceof TableSubQueryNode) { ((TableSubQueryNode) parent).setSubQuery(selectionNode); } selectionNode.setChild(joinNode); return selectionNode; }
private SelectionNode createSelectionParentForNonEquiThetaJoinQuals(LogicalPlan plan, QueryBlock block, Stack<LogicalNode> stack, JoinNode joinNode, List<EvalNode> nonEquiThetaJoinQuals) { SelectionNode selectionNode = plan.createNode(SelectionNode.class); selectionNode.setInSchema(joinNode.getOutSchema()); selectionNode.setOutSchema(joinNode.getOutSchema()); selectionNode.setQual(AlgebraicUtil.createSingletonExprFromCNF(nonEquiThetaJoinQuals)); block.registerNode(selectionNode); LogicalNode parent = stack.peek(); if (parent instanceof UnaryNode) { ((UnaryNode) parent).setChild(selectionNode); } else if (parent instanceof BinaryNode) { BinaryNode binaryParent = (BinaryNode) parent; if (binaryParent.getLeftChild().getPID() == joinNode.getPID()) { binaryParent.setLeftChild(selectionNode); } else if (binaryParent.getRightChild().getPID() == joinNode.getPID()) { binaryParent.setRightChild(selectionNode); } } else if (parent instanceof TableSubQueryNode) { ((TableSubQueryNode) parent).setSubQuery(selectionNode); } selectionNode.setChild(joinNode); return selectionNode; }
node.setQual(AlgebraicUtil.createSingletonExprFromDNF(rewrittenDnfs.toArray(new EvalNode[rewrittenDnfs.size()])));