@Override public LogicalNode visitJoin(Object context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode joinNode, Stack<LogicalNode> stack) throws TajoException { if (joinNode.hasJoinQual()) { joinNode.setJoinQual(evalRewriter.visit(null, joinNode.getJoinQual(), new Stack<EvalNode>())); } return null; } }
@Override public LogicalNode visitJoin(Object context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode joinNode, Stack<LogicalNode> stack) throws TajoException { if (joinNode.hasJoinQual()) { joinNode.setJoinQual(evalRewriter.visit(null, joinNode.getJoinQual(), new Stack<>())); } return null; } }
@Override public LogicalNode visitJoin(PlanShapeFixerContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, Stack<LogicalNode> stack) throws TajoException { super.visitJoin(context, plan, block, node, stack); int rightChildNum = context.childNumbers.pop(); int leftChildNum = context.childNumbers.pop(); if (node.hasTargets()) { node.setTargets(sortTargets(node.getTargets())); } if (node.hasJoinQual()) { node.setJoinQual(sortQual(node.getJoinQual())); } context.childNumbers.push(rightChildNum + leftChildNum); return null; }
@Override public LogicalNode visitJoin(PlanShapeFixerContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, JoinNode node, Stack<LogicalNode> stack) throws TajoException { super.visitJoin(context, plan, block, node, stack); int rightChildNum = context.childNumbers.pop(); int leftChildNum = context.childNumbers.pop(); if (node.hasTargets()) { node.setTargets(sortTargets(node.getTargets())); } if (node.hasJoinQual()) { node.setJoinQual(sortQual(node.getJoinQual())); } context.childNumbers.push(rightChildNum + leftChildNum); return null; }
joinNode.setJoinQual(qual);
joinNode.setJoinQual(qual);
joinNode.setJoinQual(njCond); } else if (join.hasQual()) { // otherwise, the given join conditions are set joinNode.setJoinQual(joinCondition);
joinNode.setJoinQual(njCond); } else if (join.hasQual()) { // otherwise, the given join conditions are set joinNode.setJoinQual(joinCondition);
throw new TajoInternalError("Join condition must be evaluated in the proper Join Node: " + joinQualReference); } else { node.setJoinQual(target.getEvalTree()); newContext.targetListMgr.markAsEvaluated(target);
throw new TajoInternalError("Join condition must be evaluated in the proper Join Node: " + joinQualReference); } else { node.setJoinQual(target.getEvalTree()); newContext.targetListMgr.markAsEvaluated(target);
private static JoinNode convertJoin(OverridableConf context, EvalContext evalContext, Map<Integer, LogicalNode> nodeMap, PlanProto.LogicalNode protoNode) { PlanProto.JoinNode joinProto = protoNode.getJoin(); JoinNode join = new JoinNode(protoNode.getNodeId()); join.setLeftChild(nodeMap.get(joinProto.getLeftChildSeq())); join.setRightChild(nodeMap.get(joinProto.getRightChilSeq())); join.setJoinType(convertJoinType(joinProto.getJoinType())); join.setInSchema(convertSchema(protoNode.getInSchema())); join.setOutSchema(convertSchema(protoNode.getOutSchema())); if (joinProto.hasJoinQual()) { join.setJoinQual(EvalNodeDeserializer.deserialize(context, evalContext, joinProto.getJoinQual())); } if (joinProto.getExistsTargets()) { join.setTargets(convertTargets(context, evalContext, joinProto.getTargetsList())); } return join; }
private static JoinNode convertJoin(OverridableConf context, EvalContext evalContext, Map<Integer, LogicalNode> nodeMap, PlanProto.LogicalNode protoNode) { PlanProto.JoinNode joinProto = protoNode.getJoin(); JoinNode join = new JoinNode(protoNode.getNodeId()); join.setLeftChild(nodeMap.get(joinProto.getLeftChildSeq())); join.setRightChild(nodeMap.get(joinProto.getRightChilSeq())); join.setJoinType(convertJoinType(joinProto.getJoinType())); join.setInSchema(convertSchema(protoNode.getInSchema())); join.setOutSchema(convertSchema(protoNode.getOutSchema())); if (joinProto.hasJoinQual()) { join.setJoinQual(EvalNodeDeserializer.deserialize(context, evalContext, joinProto.getJoinQual())); } if (joinProto.getExistsTargets()) { join.setTargets(convertTargets(context, evalContext, joinProto.getTargetsList())); } return join; }
joinNode.setJoinQual(buildJoinCondition(leftEval, subqueryEval.getSubQueryNode())); ProjectionNode projectionNode = PlannerUtil.findTopNode(subqueryEval.getSubQueryNode(), NodeType.PROJECTION);
joinNode.setJoinQual(buildJoinCondition(leftEval, subqueryEval.getSubQueryNode())); ProjectionNode projectionNode = PlannerUtil.findTopNode(subqueryEval.getSubQueryNode(), NodeType.PROJECTION);
@Override public LogicalNode buildPlan(LogicalPlan plan, LogicalPlan.QueryBlock block) { // TODO LogicalNode leftChild = joinEdge.getLeftVertex().buildPlan(plan, block); LogicalNode rightChild = joinEdge.getRightVertex().buildPlan(plan, block); JoinNode joinNode = plan.createNode(JoinNode.class); if (PlannerUtil.isCommutativeJoinType(joinEdge.getJoinType())) { // if only one operator is relation if ((leftChild instanceof RelationNode) && !(rightChild instanceof RelationNode)) { // for left deep joinNode.init(joinEdge.getJoinType(), rightChild, leftChild); } else { // if both operators are relation or if both are relations // we don't need to concern the left-right position. joinNode.init(joinEdge.getJoinType(), leftChild, rightChild); } } else { joinNode.init(joinEdge.getJoinType(), leftChild, rightChild); } Schema mergedSchema = SchemaUtil.merge(joinNode.getLeftChild().getOutSchema(), joinNode.getRightChild().getOutSchema()); joinNode.setInSchema(mergedSchema); joinNode.setOutSchema(mergedSchema); if (joinEdge.hasJoinQual()) { joinNode.setJoinQual(joinEdge.getSingletonJoinQual()); } block.registerNode(joinNode); return joinNode; }
@Override public LogicalNode buildPlan(LogicalPlan plan, LogicalPlan.QueryBlock block) { // TODO LogicalNode leftChild = joinEdge.getLeftVertex().buildPlan(plan, block); LogicalNode rightChild = joinEdge.getRightVertex().buildPlan(plan, block); JoinNode joinNode = plan.createNode(JoinNode.class); if (PlannerUtil.isCommutativeJoinType(joinEdge.getJoinType())) { // if only one operator is relation if ((leftChild instanceof RelationNode) && !(rightChild instanceof RelationNode)) { // for left deep joinNode.init(joinEdge.getJoinType(), rightChild, leftChild); } else { // if both operators are relation or if both are relations // we don't need to concern the left-right position. joinNode.init(joinEdge.getJoinType(), leftChild, rightChild); } } else { joinNode.init(joinEdge.getJoinType(), leftChild, rightChild); } Schema mergedSchema = SchemaUtil.merge(joinNode.getLeftChild().getOutSchema(), joinNode.getRightChild().getOutSchema()); joinNode.setInSchema(mergedSchema); joinNode.setOutSchema(mergedSchema); if (joinEdge.hasJoinQual()) { joinNode.setJoinQual(joinEdge.getSingletonJoinQual()); } block.registerNode(joinNode); return joinNode; }