public void setChild(LogicalNode subNode) { super.setChild(subNode); }
public void setChild(LogicalNode subNode) { super.setChild(subNode); }
public void setChild(LogicalNode subNode) { super.setChild(subNode); }
public void setChild(LogicalNode subNode) { super.setChild(subNode); }
public void setChild(LogicalNode subNode) { super.setChild(subNode); }
public void setChild(LogicalNode subNode) { super.setChild(subNode); }
public static void replaceNode(LogicalNode plan, LogicalNode newNode, NodeType type) { LogicalNode parent = findTopParentNode(plan, type); Preconditions.checkArgument(parent instanceof UnaryNode); Preconditions.checkArgument(!(newNode instanceof BinaryNode)); UnaryNode parentNode = (UnaryNode) parent; LogicalNode child = parentNode.getChild(); if (child instanceof UnaryNode) { ((UnaryNode) newNode).setChild(((UnaryNode) child).getChild()); } parentNode.setChild(newNode); }
public static void replaceNode(LogicalNode plan, LogicalNode newNode, NodeType type) { LogicalNode parent = findTopParentNode(plan, type); Preconditions.checkArgument(parent instanceof UnaryNode); Preconditions.checkArgument(!(newNode instanceof BinaryNode)); UnaryNode parentNode = (UnaryNode) parent; LogicalNode child = parentNode.getChild(); if (child instanceof UnaryNode) { ((UnaryNode) newNode).setChild(((UnaryNode) child).getChild()); } parentNode.setChild(newNode); }
if (node instanceof UnaryNode) { UnaryNode unary = (UnaryNode) node; unary.setChild(selNode.getChild()); } else { throw new TajoInternalError("The node must be an unary node");
if (node instanceof UnaryNode) { UnaryNode unary = (UnaryNode) node; unary.setChild(selNode.getChild()); } else { throw new TajoInternalError("The node must be an unary node");
/** * Delete the logical node from a plan. * * @param parent this node must be a parent node of one node to be removed. * @param tobeRemoved this node must be a child node of the parent. */ public static LogicalNode deleteNode(LogicalNode parent, LogicalNode tobeRemoved) { Preconditions.checkArgument(tobeRemoved instanceof UnaryNode, "ERROR: the logical node to be removed must be unary node."); UnaryNode child = (UnaryNode) tobeRemoved; LogicalNode grandChild = child.getChild(); if (parent instanceof UnaryNode) { UnaryNode unaryParent = (UnaryNode) parent; Preconditions.checkArgument(unaryParent.getChild() == child, "ERROR: both logical node must be parent and child nodes"); unaryParent.setChild(grandChild); } else if (parent instanceof BinaryNode) { BinaryNode binaryParent = (BinaryNode) parent; if (binaryParent.getLeftChild().deepEquals(child)) { binaryParent.setLeftChild(grandChild); } else if (binaryParent.getRightChild().deepEquals(child)) { binaryParent.setRightChild(grandChild); } else { throw new TajoInternalError("both logical node must be parent and child nodes"); } } else { throw new TajoInternalError("unexpected logical plan: " + parent); } return child; }
/** * Delete the logical node from a plan. * * @param parent this node must be a parent node of one node to be removed. * @param tobeRemoved this node must be a child node of the parent. */ public static LogicalNode deleteNode(LogicalNode parent, LogicalNode tobeRemoved) { Preconditions.checkArgument(tobeRemoved instanceof UnaryNode, "ERROR: the logical node to be removed must be unary node."); UnaryNode child = (UnaryNode) tobeRemoved; LogicalNode grandChild = child.getChild(); if (parent instanceof UnaryNode) { UnaryNode unaryParent = (UnaryNode) parent; Preconditions.checkArgument(unaryParent.getChild() == child, "ERROR: both logical node must be parent and child nodes"); unaryParent.setChild(grandChild); } else if (parent instanceof BinaryNode) { BinaryNode binaryParent = (BinaryNode) parent; if (binaryParent.getLeftChild().deepEquals(child)) { binaryParent.setLeftChild(grandChild); } else if (binaryParent.getRightChild().deepEquals(child)) { binaryParent.setRightChild(grandChild); } else { throw new TajoInternalError("both logical node must be parent and child nodes"); } } else { throw new TajoInternalError("unexpected logical plan: " + parent); } return child; }
/** * Replace a child of the given parent logical node with the new one. * * @param newChild * @param originalChild * @param parent */ public static void replaceChild(LogicalNode newChild, ScanNode originalChild, LogicalNode parent) { if (parent instanceof UnaryNode) { ((UnaryNode) parent).setChild(newChild); } else if (parent instanceof BinaryNode) { BinaryNode binary = (BinaryNode) parent; if (binary.getLeftChild().equals(originalChild)) { binary.setLeftChild(newChild); } else if (binary.getRightChild().equals(originalChild)) { binary.setRightChild(newChild); } else { throw new TajoInternalError(originalChild.getPID() + " is not a child of " + parent.getPID()); } } else { throw new TajoInternalError(parent.getPID() + " seems to not have any children"); } }
/** * Replace a child of the given parent logical node with the new one. * * @param newChild * @param originalChild * @param parent */ public static void replaceChild(LogicalNode newChild, ScanNode originalChild, LogicalNode parent) { if (parent instanceof UnaryNode) { ((UnaryNode) parent).setChild(newChild); } else if (parent instanceof BinaryNode) { BinaryNode binary = (BinaryNode) parent; if (binary.getLeftChild().equals(originalChild)) { binary.setLeftChild(newChild); } else if (binary.getRightChild().equals(originalChild)) { binary.setRightChild(newChild); } else { throw new TajoInternalError(originalChild.getPID() + " is not a child of " + parent.getPID()); } } else { throw new TajoInternalError(parent.getPID() + " seems to not have any children"); } }
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; }
insertNode.setChild(sortNode); plan.getRootBlock().registerNode(sortNode);
insertNode.setChild(sortNode); plan.getRootBlock().registerNode(sortNode);
UnaryNode unaryNode = (UnaryNode) node; if (unaryNode.getChild().deepEquals(target)) { unaryNode.setChild(tobeReplaced); left = tobeReplaced; context.updateSchemaFlag = true;
UnaryNode unaryNode = (UnaryNode) node; if (unaryNode.getChild().deepEquals(target)) { unaryNode.setChild(tobeReplaced); left = tobeReplaced; context.updateSchemaFlag = true;