private boolean isDependentFinalDestination(PlanNode critNode, PlanNode currentNode) { return critNode.hasBooleanProperty(NodeConstants.Info.IS_DEPENDENT_SET) && NodeEditor.findNodePreOrder(currentNode.getFirstChild(), NodeConstants.Types.GROUP, NodeConstants.Types.SOURCE) == null; }
private boolean isDependentFinalDestination(PlanNode critNode, PlanNode currentNode) { return critNode.hasBooleanProperty(NodeConstants.Info.IS_DEPENDENT_SET) && NodeEditor.findNodePreOrder(currentNode.getFirstChild(), NodeConstants.Types.GROUP, NodeConstants.Types.SOURCE) == null; }
private boolean isDependentFinalDestination(PlanNode critNode, PlanNode currentNode) { return critNode.hasBooleanProperty(NodeConstants.Info.IS_DEPENDENT_SET) && NodeEditor.findNodePreOrder(currentNode.getFirstChild(), NodeConstants.Types.GROUP, NodeConstants.Types.SOURCE) == null; }
static boolean isProcedure(PlanNode projectNode) { if(projectNode != null && projectNode.getType() == NodeConstants.Types.PROJECT && projectNode.getChildCount() > 0) { PlanNode accessNode = projectNode.getFirstChild(); Command command = getNonQueryCommand(accessNode); return command instanceof StoredProcedure; } return false; }
static boolean isProcedure(PlanNode projectNode) { if(projectNode != null && projectNode.getType() == NodeConstants.Types.PROJECT && projectNode.getChildCount() > 0) { PlanNode accessNode = projectNode.getFirstChild(); Command command = getNonQueryCommand(accessNode); return command instanceof StoredProcedure; } return false; }
static boolean isProcedure(PlanNode projectNode) { if(projectNode != null && projectNode.getType() == NodeConstants.Types.PROJECT && projectNode.getChildCount() > 0) { PlanNode accessNode = projectNode.getFirstChild(); Command command = getNonQueryCommand(accessNode); return command instanceof StoredProcedure; } return false; }
/** * all of child's children become children of parent */ public static final void removeChildNode(PlanNode parent, PlanNode child) { if (child.getChildCount() == 0) { parent.removeChild(child); } else if (child.getChildCount() == 1){ PlanNode grandChild = child.getFirstChild(); parent.replaceChild(child, grandChild); } else { throw new AssertionError("Cannot promote a multinode child"); //$NON-NLS-1$ } }
/** * all of child's children become children of parent */ public static final void removeChildNode(PlanNode parent, PlanNode child) { if (child.getChildCount() == 0) { parent.removeChild(child); } else if (child.getChildCount() == 1){ PlanNode grandChild = child.getFirstChild(); parent.replaceChild(child, grandChild); } else { throw new AssertionError("Cannot promote a multinode child"); //$NON-NLS-1$ } }
/** * all of child's children become children of parent */ public static final void removeChildNode(PlanNode parent, PlanNode child) { if (child.getChildCount() == 0) { parent.removeChild(child); } else if (child.getChildCount() == 1){ PlanNode grandChild = child.getFirstChild(); parent.replaceChild(child, grandChild); } else { throw new AssertionError("Cannot promote a multinode child"); //$NON-NLS-1$ } }
/** * Estimate the cost of a selection. This is not easy to do without information * about the value count for each relation attribute. * @param metadata */ private static void estimateSelectNodeCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); //Get list of conjuncts Criteria selectCriteria = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA); float newCost = recursiveEstimateCostOfCriteria(childCost, node, selectCriteria, metadata); setCardinalityEstimate(node, newCost, true, metadata); }
/** * Estimate the cost of a selection. This is not easy to do without information * about the value count for each relation attribute. * @param metadata */ private static void estimateSelectNodeCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); //Get list of conjuncts Criteria selectCriteria = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA); float newCost = recursiveEstimateCostOfCriteria(childCost, node, selectCriteria, metadata); setCardinalityEstimate(node, newCost, true, metadata); }
private static void estimateSetOpCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { float cost = 0; SetQuery.Operation op = (SetQuery.Operation)node.getProperty(NodeConstants.Info.SET_OPERATION); float leftCost = (Float)node.getFirstChild().getProperty(NodeConstants.Info.EST_CARDINALITY); float rightCost = (Float)node.getLastChild().getProperty(NodeConstants.Info.EST_CARDINALITY); if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) { leftCost = getDistinctEstimate(node.getFirstChild(), metadata, leftCost); rightCost = getDistinctEstimate(node.getLastChild(), metadata, rightCost); } cost = getCombinedSetEstimate(op, leftCost, rightCost, !node.hasBooleanProperty(NodeConstants.Info.USE_ALL)); setCardinalityEstimate(node, new Float(cost), true, metadata); }
private static void estimateSetOpCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { float cost = 0; SetQuery.Operation op = (SetQuery.Operation)node.getProperty(NodeConstants.Info.SET_OPERATION); float leftCost = (Float)node.getFirstChild().getProperty(NodeConstants.Info.EST_CARDINALITY); float rightCost = (Float)node.getLastChild().getProperty(NodeConstants.Info.EST_CARDINALITY); if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) { leftCost = getDistinctEstimate(node.getFirstChild(), metadata, leftCost); rightCost = getDistinctEstimate(node.getLastChild(), metadata, rightCost); } cost = getCombinedSetEstimate(op, leftCost, rightCost, !node.hasBooleanProperty(NodeConstants.Info.USE_ALL)); setCardinalityEstimate(node, new Float(cost), true, metadata); }
private static void estimateSetOpCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { float cost = 0; SetQuery.Operation op = (SetQuery.Operation)node.getProperty(NodeConstants.Info.SET_OPERATION); float leftCost = (Float)node.getFirstChild().getProperty(NodeConstants.Info.EST_CARDINALITY); float rightCost = (Float)node.getLastChild().getProperty(NodeConstants.Info.EST_CARDINALITY); if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) { leftCost = getDistinctEstimate(node.getFirstChild(), metadata, leftCost); rightCost = getDistinctEstimate(node.getLastChild(), metadata, rightCost); } cost = getCombinedSetEstimate(op, leftCost, rightCost, !node.hasBooleanProperty(NodeConstants.Info.USE_ALL)); setCardinalityEstimate(node, new Float(cost), true, metadata); }
public void testRemoveLastChildNode() { PlanNode tree = exampleTree1(); List expectedChildren = new ArrayList(); expectedChildren.add(tree.getFirstChild()); expectedChildren.addAll(tree.getLastChild().getChildren()); NodeEditor.removeChildNode(tree, tree.getLastChild()); List actualChildren = tree.getChildren(); assertEquals("Didn't get expected children after removing last child", expectedChildren, actualChildren); //$NON-NLS-1$ }
/** * @param joinNode */ static void swapJoinChildren(PlanNode joinNode) { PlanNode leftChild = joinNode.getFirstChild(); joinNode.removeChild(leftChild); joinNode.addLastChild(leftChild); List leftExpressions = (List)joinNode.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS); List rightExpressions = (List)joinNode.getProperty(NodeConstants.Info.RIGHT_EXPRESSIONS); joinNode.setProperty(NodeConstants.Info.LEFT_EXPRESSIONS, rightExpressions); joinNode.setProperty(NodeConstants.Info.RIGHT_EXPRESSIONS, leftExpressions); JoinType jt = (JoinType)joinNode.getProperty(NodeConstants.Info.JOIN_TYPE); joinNode.setProperty(NodeConstants.Info.JOIN_TYPE, jt.getReverseType()); }
/** * @param joinNode */ static void swapJoinChildren(PlanNode joinNode) { PlanNode leftChild = joinNode.getFirstChild(); joinNode.removeChild(leftChild); joinNode.addLastChild(leftChild); List leftExpressions = (List)joinNode.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS); List rightExpressions = (List)joinNode.getProperty(NodeConstants.Info.RIGHT_EXPRESSIONS); joinNode.setProperty(NodeConstants.Info.LEFT_EXPRESSIONS, rightExpressions); joinNode.setProperty(NodeConstants.Info.RIGHT_EXPRESSIONS, leftExpressions); JoinType jt = (JoinType)joinNode.getProperty(NodeConstants.Info.JOIN_TYPE); joinNode.setProperty(NodeConstants.Info.JOIN_TYPE, jt.getReverseType()); }
private void updateGroups(PlanNode node) { node.addGroups(GroupsUsedByElementsVisitor.getGroups(node.getCorrelatedReferenceElements())); node.addGroups(FrameUtil.findJoinSourceNode(node.getFirstChild()).getGroups()); node.addGroups(FrameUtil.findJoinSourceNode(node.getLastChild()).getGroups()); }
private void updateGroups(PlanNode node) { node.addGroups(GroupsUsedByElementsVisitor.getGroups(node.getCorrelatedReferenceElements())); node.addGroups(FrameUtil.findJoinSourceNode(node.getFirstChild()).getGroups()); node.addGroups(FrameUtil.findJoinSourceNode(node.getLastChild()).getGroups()); }
private void updateGroups(PlanNode node) { node.addGroups(GroupsUsedByElementsVisitor.getGroups(node.getCorrelatedReferenceElements())); node.addGroups(FrameUtil.findJoinSourceNode(node.getFirstChild()).getGroups()); node.addGroups(FrameUtil.findJoinSourceNode(node.getLastChild()).getGroups()); }