/** * To switch directions from left to right or right to left. Joins * that are not LEFT OUTER or RIGHT OUTER are returned unchanged. * @return New JoinType constant for the reverse join type */ public JoinType getReverseType() { if(this.equals(JOIN_RIGHT_OUTER)) { return JOIN_LEFT_OUTER; } else if(this.equals(JOIN_LEFT_OUTER)) { return JOIN_RIGHT_OUTER; } return this; }
/** * Override Object.equals() to compare objects * @param other Other object * @return True if equal */ public boolean equals(Object other) { if(this == other) { return true; } if(! (other instanceof JoinType)) { return false; } return ((JoinType)other).getTypeCode() == this.type; }
public static JoinType getJoinTypePreventingCriteriaOptimization(PlanNode joinNode, Set<GroupSymbol> groups) { JoinType joinType = (JoinType) joinNode.getProperty(NodeConstants.Info.JOIN_TYPE); if(!joinType.isOuter()) { return null; } if(joinType.equals(JoinType.JOIN_FULL_OUTER)) { return joinType; } Set<GroupSymbol> innerGroups = getInnerSideJoinNodes(joinNode)[0].getGroups(); for (GroupSymbol group : groups) { if (innerGroups.contains(group)) { return joinType; } } return null; }
if (!jtype.isOuter()) { candidate.leftCandidate=true; candidates.add(candidate);
/** * @see org.teiid.query.processor.relational.RelationalNode#getNodeString(java.lang.StringBuffer) * @since 4.2 */ protected void getNodeString(StringBuffer str) { str.append(getClassName()); str.append("("); //$NON-NLS-1$ str.append(getID()); str.append(") [");//$NON-NLS-1$ if(isDependent()) { str.append("Dependent] [");//$NON-NLS-1$ } str.append(this.joinStrategy.toString()); str.append("] [");//$NON-NLS-1$ str.append(this.joinType.toString()); str.append("]"); //$NON-NLS-1$ if (getJoinType() != JoinType.JOIN_CROSS) { str.append(" criteria=").append(getCriteriaList()); //$NON-NLS-1$ } str.append(" output="); //$NON-NLS-1$ str.append(getElements()); }
/** * @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()); }
if (!jtype.isOuter()) { candidate.leftCandidate=true; candidates.add(candidate);
/** * @see org.teiid.query.processor.relational.RelationalNode#getNodeString(java.lang.StringBuffer) * @since 4.2 */ protected void getNodeString(StringBuffer str) { str.append(getClassName()); str.append("("); //$NON-NLS-1$ str.append(getID()); str.append(") [");//$NON-NLS-1$ if(isDependent()) { str.append("Dependent] [");//$NON-NLS-1$ } str.append(this.joinStrategy.toString()); str.append("] [");//$NON-NLS-1$ str.append(this.joinType.toString()); str.append("]"); //$NON-NLS-1$ if (getJoinType() != JoinType.JOIN_CROSS) { str.append(" criteria=").append(getCriteriaList()); //$NON-NLS-1$ } str.append(" output="); //$NON-NLS-1$ str.append(getElements()); }
/** * @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()); }
/** * To switch directions from left to right or right to left. Joins * that are not LEFT OUTER or RIGHT OUTER are returned unchanged. * @return New JoinType constant for the reverse join type */ public JoinType getReverseType() { if(this.equals(JOIN_RIGHT_OUTER)) { return JOIN_LEFT_OUTER; } else if(this.equals(JOIN_LEFT_OUTER)) { return JOIN_RIGHT_OUTER; } return this; }
public static JoinType getJoinTypePreventingCriteriaOptimization(PlanNode joinNode, Set<GroupSymbol> groups) { JoinType joinType = (JoinType) joinNode.getProperty(NodeConstants.Info.JOIN_TYPE); if(!joinType.isOuter()) { return null; } if(joinType.equals(JoinType.JOIN_FULL_OUTER)) { return joinType; } Set<GroupSymbol> innerGroups = getInnerSideJoinNodes(joinNode)[0].getGroups(); for (GroupSymbol group : groups) { if (innerGroups.contains(group)) { return joinType; } } return null; }
if (!jtype.isOuter()) { candidate.leftCandidate=true; candidates.add(candidate);
/** * Override Object.equals() to compare objects * @param other Other object * @return True if equal */ public boolean equals(Object other) { if(this == other) { return true; } if(! (other instanceof JoinType)) { return false; } return ((JoinType)other).getTypeCode() == this.type; }
/** * @see org.teiid.query.processor.relational.RelationalNode#getNodeString(java.lang.StringBuffer) * @since 4.2 */ protected void getNodeString(StringBuffer str) { str.append(getClassName()); str.append("("); //$NON-NLS-1$ str.append(getID()); str.append(") [");//$NON-NLS-1$ if(isDependent()) { str.append("Dependent] [");//$NON-NLS-1$ } str.append(this.joinStrategy.toString()); str.append("] [");//$NON-NLS-1$ str.append(this.joinType.toString()); str.append("]"); //$NON-NLS-1$ if (getJoinType() != JoinType.JOIN_CROSS) { str.append(" criteria=").append(getCriteriaList()); //$NON-NLS-1$ } str.append(" output="); //$NON-NLS-1$ str.append(getElements()); }
/** * @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()); }
/** * To switch directions from left to right or right to left. Joins * that are not LEFT OUTER or RIGHT OUTER are returned unchanged. * @return New JoinType constant for the reverse join type */ public JoinType getReverseType() { if(this.equals(JOIN_RIGHT_OUTER)) { return JOIN_LEFT_OUTER; } else if(this.equals(JOIN_LEFT_OUTER)) { return JOIN_RIGHT_OUTER; } return this; }
public static JoinType getJoinTypePreventingCriteriaOptimization(PlanNode joinNode, Set<GroupSymbol> groups) { JoinType joinType = (JoinType) joinNode.getProperty(NodeConstants.Info.JOIN_TYPE); if(!joinType.isOuter()) { return null; } if(joinType.equals(JoinType.JOIN_FULL_OUTER)) { return joinType; } Set<GroupSymbol> innerGroups = getInnerSideJoinNodes(joinNode)[0].getGroups(); for (GroupSymbol group : groups) { if (innerGroups.contains(group)) { return joinType; } } return null; }
/** * @param clause Clause to check recursively * @return True if tree has outer joins, false otherwise */ static boolean hasOuterJoins(FromClause clause) { if (clause instanceof SubqueryFromClause) { if (((SubqueryFromClause)clause).isLateral()) { return true; } return false; } if(clause instanceof UnaryFromClause) { return false; } JoinPredicate jp = (JoinPredicate) clause; if(jp.getJoinType().isOuter()) { return true; } // Walk children boolean childHasOuter = hasOuterJoins(jp.getLeftClause()); if(childHasOuter) { return true; } return hasOuterJoins(jp.getRightClause()); }
/** * Override Object.equals() to compare objects * @param other Other object * @return True if equal */ public boolean equals(Object other) { if(this == other) { return true; } if(! (other instanceof JoinType)) { return false; } return ((JoinType)other).getTypeCode() == this.type; }
/** * @see org.teiid.query.processor.relational.RelationalNode#getDescriptionProperties() * @since 4.2 */ public PlanNode getDescriptionProperties() { // Default implementation - should be overridden PlanNode props = super.getDescriptionProperties(); if(isDependent()) { props.addProperty(PROP_DEPENDENT, Boolean.TRUE.toString()); } props.addProperty(PROP_JOIN_STRATEGY, this.joinStrategy.toString()); props.addProperty(PROP_JOIN_TYPE, this.joinType.toString()); List<String> critList = getCriteriaList(); props.addProperty(PROP_JOIN_CRITERIA, critList); return props; }