/** * @see org.teiid.query.processor.relational.JoinStrategy#clone() */ @Override public MergeJoinStrategy clone() { return new MergeJoinStrategy(sortLeft, sortRight, grouping).singleMatch(singleMatch); }
@Override public void close() { if (joinNode == null) { return; } super.close(); if (this.index != null) { this.index.remove(); } }
public static int sameGroup(int[] indexes, List<?> newTuple, List<?> oldTuple) { if (indexes == null) { return -1; } return MergeJoinStrategy.compareTuples(newTuple, oldTuple, indexes, indexes, true, true); }
result = 1; } else { result = compare(this.leftSource.getCurrentTuple(), this.rightSource.getCurrentTuple(), this.leftSource.getExpressionIndexes(), this.rightSource.getExpressionIndexes()); this.leftScanState = ScanState.READ; if (this.joinNode.getJoinType().isOuter()) { this.joinNode.addBatchRow(outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getOuterVals())); this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), this.rightSource.getCurrentTuple())); if (compareToPrevious(outerState)) { outerMatched = false; innerState.reset(); if (!compareToPrevious(innerState)) { loopState = LoopState.LOAD_OUTER; break; List outputTuple = outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getCurrentTuple()); this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), this.rightSource.getCurrentTuple())); } else if (this.joinNode.getJoinType().isOuter()) { this.joinNode.addBatchRow(outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getOuterVals()));
return; super.loadRight(); super.loadLeft(); if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_DQP, "degrading to merged join", this.joinNode.getID()); //$NON-NLS-1$ } else { this.notSortedSource.isLimited(hasLimit); super.loadRight(); //sort if needed this.notSortedSource.sort(SortOption.NOT_SORTED); //do a single sort pass if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { } else { this.notSortedSource.isLimited(hasLimit); super.loadLeft(); //sort if needed this.notSortedSource.sort(SortOption.NOT_SORTED); //do a single sort pass if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
/** * @see org.teiid.query.processor.relational.JoinStrategy#clone() */ @Override public MergeJoinStrategy clone() { return new MergeJoinStrategy(sortLeft, sortRight, grouping); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getName()) .append(" (").append(sortLeft).append("/").append(sortRight).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (singleMatch) { sb.append(" subquery"); //$NON-NLS-1$ } return sb.toString(); }
int compare = 1; if (!target.isExpresssionDistinct()) { compare = compare(previousTuple, target.getCurrentTuple(), target.getExpressionIndexes(), target.getExpressionIndexes()); if (compare < 0) { boolean ignore = false;
result = 1; } else { result = compare(this.leftSource.getCurrentTuple(), this.rightSource.getCurrentTuple(), this.leftSource.getExpressionIndexes(), this.rightSource.getExpressionIndexes()); this.leftScanState = ScanState.READ; if (this.joinNode.getJoinType().isOuter()) { this.joinNode.addBatchRow(outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getOuterVals())); this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), this.rightSource.getCurrentTuple())); if (compareToPrevious(outerState)) { outerMatched = false; innerState.reset(); if (!compareToPrevious(innerState)) { loopState = LoopState.LOAD_OUTER; break; List outputTuple = outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getCurrentTuple()); this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), this.rightSource.getCurrentTuple())); } else if (this.joinNode.getJoinType().isOuter()) { this.joinNode.addBatchRow(outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getOuterVals()));
return; super.loadRight(); super.loadLeft(); if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_DQP, "degrading to merged join", this.joinNode.getID()); //$NON-NLS-1$ } else { this.notSortedSource.isLimited(hasLimit); super.loadRight(); //sort if needed this.notSortedSource.sort(SortOption.NOT_SORTED); //do a single sort pass if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { } else { this.notSortedSource.isLimited(hasLimit); super.loadLeft(); //sort if needed this.notSortedSource.sort(SortOption.NOT_SORTED); //do a single sort pass if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
}; helpCreateJoin(); this.joinStrategy = new MergeJoinStrategy(SortOption.SORT, SortOption.ALREADY_SORTED, false); BlockingFakeRelationalNode newNode = new BlockingFakeRelationalNode(2, rightTuples) { @Override
/** * @see java.lang.Object#toString() */ @Override public String toString() { StringBuffer sb = new StringBuffer(); return sb .append(getName()) .append(" (").append(sortLeft).append("/").append(sortRight).append(")").toString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
int compare = 1; if (!target.isExpresssionDistinct()) { compare = compare(previousTuple, target.getCurrentTuple(), target.getExpressionIndexes(), target.getExpressionIndexes()); if (compare < 0) { boolean ignore = false;
result = 1; } else { result = compare(this.leftSource.getCurrentTuple(), this.rightSource.getCurrentTuple(), this.leftSource.getExpressionIndexes(), this.rightSource.getExpressionIndexes()); this.leftScanState = ScanState.READ; if (this.joinNode.getJoinType().isOuter()) { this.joinNode.addBatchRow(outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getOuterVals())); this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), this.rightSource.getCurrentTuple())); if (compareToPrevious(outerState)) { outerMatched = false; innerState.reset(); if (!compareToPrevious(innerState)) { loopState = LoopState.LOAD_OUTER; break; List outputTuple = outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getCurrentTuple()); this.joinNode.addBatchRow(outputTuple(this.leftSource.getOuterVals(), this.rightSource.getCurrentTuple())); } else if (this.joinNode.getJoinType().isOuter()) { this.joinNode.addBatchRow(outputTuple(this.leftSource.getCurrentTuple(), this.rightSource.getOuterVals()));
/** * @see org.teiid.query.processor.relational.JoinStrategy#clone() */ @Override public MergeJoinStrategy clone() { return new MergeJoinStrategy(sortLeft, sortRight, grouping).singleMatch(singleMatch); }
return; super.loadRight(); super.loadLeft(); if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_DQP, "degrading to merged join", this.joinNode.getID()); //$NON-NLS-1$ } else { this.notSortedSource.isLimited(hasLimit); super.loadRight(); //sort if needed this.notSortedSource.sort(SortOption.NOT_SORTED); //do a single sort pass if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) { } else { this.notSortedSource.isLimited(hasLimit); super.loadLeft(); //sort if needed this.notSortedSource.sort(SortOption.NOT_SORTED); //do a single sort pass if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
joinStrategy = new MergeJoinStrategy(SortOption.SORT_DISTINCT, SortOption.SORT_DISTINCT, false);
public static int sameGroup(int[] indexes, List<?> newTuple, List<?> oldTuple) { if (indexes == null) { return -1; } return MergeJoinStrategy.compareTuples(newTuple, oldTuple, indexes, indexes, true, true); }