org.apache.derby.impl.sql.execute
Class MergeJoinResultSet

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
      extended byorg.apache.derby.impl.sql.execute.NoPutResultSetImpl
          extended byorg.apache.derby.impl.sql.execute.JoinResultSet
              extended byorg.apache.derby.impl.sql.execute.MergeJoinResultSet
All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource

public class MergeJoinResultSet
extends JoinResultSet

Merge two result sets. The left result set (the outer result set) MUST be unique for this to work correctly.


Field Summary
private static int EQUAL
           
private static int GREATER_THAN
           
private  GeneratedMethod leftGreaterThanRight
           
private static int LESS_THAN
           
 
Fields inherited from class org.apache.derby.impl.sql.execute.JoinResultSet
activation, beginTime, checkGM, checkNullCols, clonedExecRow, closeCleanup, closeTime, cncLen, compactRow, constructorTime, currentRow, endExecutionTime, finished, heapConglomerate, indent, isOpen, isRightOpen, isTopResultSet, lcc, leftNumCols, leftResultSet, leftRow, mergedRow, nextTime, notExistsRightSide, numOpens, oneRowRightSide, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, restriction, restrictionTime, resultDescription, resultSetNumber, rightNumCols, rightResultSet, rightRow, rowsFiltered, rowsReturned, rowsSeen, rowsSeenLeft, rowsSeenRight, sourceDepth, startExecutionTime, subIndent, subqueryTrackingArray, targetResultSet
 
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
 
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE
 
Constructor Summary
MergeJoinResultSet(NoPutResultSet leftResultSet, int leftNumCols, NoPutResultSet rightResultSet, int rightNumCols, Activation activation, GeneratedMethod leftGreaterThanRight, GeneratedMethod restriction, int resultSetNumber, boolean oneRowRightSide, boolean notExistsRightSide, double optimizerEstimatedRowCount, double optimizerEstimatedCost, GeneratedMethod closeCleanup)
          Create a MergeJoinResultSet
 
Method Summary
 void close()
          If the result set has been opened, close the open scan.
 ExecRow getNextRowCore()
          Return the requested values computed from the next row (if any) for which the restriction evaluates to true.
private  ExecRow getReturnRow(ExecRow leftRow, ExecRow rightRow)
           
 long getTimeSpent(int type)
          Return the total amount of time spent in this ResultSet
private  boolean restrictionIsTrue()
           
 
Methods inherited from class org.apache.derby.impl.sql.execute.JoinResultSet
addWarning, attachStatementContext, checkRowPosition, cleanUp, clearCurrentRow, clearOrderableCache, clearScanState, closeRight, closeRowSource, dumpTimeStats, finish, finishAndRTS, getAbsoluteRow, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentRow, getCurrentTimeMillis, getCursorName, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getNextRowFromRowSource, getPointOfAttachment, getPreviousRow, getRelativeRow, getResultDescription, getRowLocation, getRowNumber, getScanIsolationLevel, getSubqueryTrackingArray, getTransactionController, getValidColumns, getWarnings, isClosed, isForUpdate, markAsTopResultSet, modifiedRowCount, needsRowLocation, needsToClone, open, openCore, openRight, printQualifiers, reopenCore, requiresRelocking, resultSetNumber, returnsRows, rowLocation, setAfterLastRow, setBeforeFirstRow, setCheckConstraints, setCompactRow, setCompatRow, setCurrentRow, setHeapConglomerate, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.sql.ResultSet
checkRowPosition, cleanUp, getAbsoluteRow, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow
 

Field Detail

GREATER_THAN

private static final int GREATER_THAN
See Also:
Constant Field Values

EQUAL

private static final int EQUAL
See Also:
Constant Field Values

LESS_THAN

private static final int LESS_THAN
See Also:
Constant Field Values

leftGreaterThanRight

private GeneratedMethod leftGreaterThanRight
Constructor Detail

MergeJoinResultSet

public MergeJoinResultSet(NoPutResultSet leftResultSet,
                          int leftNumCols,
                          NoPutResultSet rightResultSet,
                          int rightNumCols,
                          Activation activation,
                          GeneratedMethod leftGreaterThanRight,
                          GeneratedMethod restriction,
                          int resultSetNumber,
                          boolean oneRowRightSide,
                          boolean notExistsRightSide,
                          double optimizerEstimatedRowCount,
                          double optimizerEstimatedCost,
                          GeneratedMethod closeCleanup)
Create a MergeJoinResultSet

Parameters:
leftResultSet - the left (outer) result set
leftNumCols - columns in left row
rightResultSet - the right (outer) result set
rightNumCols - columns in right row
activation - activation
leftGreaterThanRight - a generated method that is used to ascertain whether the row from the left result set is greater than the row from the right result set. returns 1,0,or -1 to indicate greater than, equal, or less than, respectively
restriction - generated method for additional qualification
resultSetNumber - the result set number
oneRowRightSide - ignored
optimizerEstimatedRowCount - self-explanatory
optimizerEstimatedCost - self-explanatory
closeCleanup - self-explanatory
Method Detail

getNextRowCore

public ExecRow getNextRowCore()
                       throws StandardException
Return the requested values computed from the next row (if any) for which the restriction evaluates to true.

restriction parameters are evaluated for each row.

Specified by:
getNextRowCore in interface NoPutResultSet
Specified by:
getNextRowCore in class BasicNoPutResultSetImpl
Returns:
the next row in the join result
Throws:
StandardException - Thrown on error
StandardException - ResultSetNotOpen thrown if closed
See Also:
NoPutResultSet.getNextRowCore()

close

public void close()
           throws StandardException
If the result set has been opened, close the open scan.

Specified by:
close in interface ResultSet
Overrides:
close in class JoinResultSet
Throws:
StandardException - thrown on error

getTimeSpent

public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet

Parameters:
type - CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.
Returns:
long The total amount of time spent (in milliseconds).

getReturnRow

private ExecRow getReturnRow(ExecRow leftRow,
                             ExecRow rightRow)
                      throws StandardException
Throws:
StandardException

restrictionIsTrue

private boolean restrictionIsTrue()
                           throws StandardException
Throws:
StandardException

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.