Class SetOpResultSet
java.lang.Object
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
org.apache.derby.impl.sql.execute.NoPutResultSetImpl
org.apache.derby.impl.sql.execute.SetOpResultSet
- All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource
Takes the result set produced by an ordered UNION ALL of two tagged result sets and produces
the INTERSECT or EXCEPT of the two input result sets. This also projects out the tag, the last column
of the input rows.
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Activationprivate final booleanprivate final int[]private final int[]private final boolean[]private ExecRowprivate final NoPutResultSetprivate final intprivate DataValueDescriptor[]private final intprivate ExecRowprivate final NoPutResultSetprivate intprivate intprivate intFields inherited from class NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, targetResultSetFields inherited from class BasicNoPutResultSetImpl
beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArrayFields inherited from interface NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBERFields inherited from interface ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST -
Constructor Summary
ConstructorsConstructorDescriptionSetOpResultSet(NoPutResultSet leftSource, NoPutResultSet rightSource, Activation activation, int resultSetNumber, long optimizerEstimatedRowCount, double optimizerEstimatedCost, int opType, boolean all, int intermediateOrderByColumnsSavedObject, int intermediateOrderByDirectionSavedObject, int intermediateOrderByNullsLowSavedObject) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidadvanceRightPastDuplicates(DataValueDescriptor[] leftColumns) voidclose()If the result set has been opened, close the currently open source.private intcompare(DataValueDescriptor[] leftCols, DataValueDescriptor[] rightCols) voidfinish()Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open().Returns the current row of the result set.Return the left source input of thisSetOpResultSetReturn the requested values computed from the next row (if any) for which the restriction evaluates to true.intReturn the set operation of thisSetOpResultSetintReturn the result set numberReturn the right source input of thisSetOpResultSetReturns the row location of the current base table row of the cursor.intReturn the number of rows returned from the result setintReturn the number of rows seen on the left source inputintReturn the number of rows seen on the right source inputlonggetTimeSpent(int type) Return the total amount of time spent in this ResultSetprivate booleanisDuplicate(DataValueDescriptor[] curColumns) voidopenCore()open the first source.Methods inherited from class NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, isForUpdate, markRowAsDeleted, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue, updateRowMethods inherited from class BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, childrenToXML, cleanUp, dumpTimeStats, finishAndRTS, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getPointOfAttachment, getPreviousRow, getRelativeRow, getRowNumber, getScanIsolationLevel, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, reopenCore, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXML, toXMLMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ResultSet
addWarning, checkRowPosition, cleanUp, clearCurrentRow, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
Field Details
-
leftSource
-
rightSource
-
activation
-
opType
private final int opType -
all
private final boolean all -
resultSetNumber
private final int resultSetNumber -
prevCols
-
leftInputRow
-
rightInputRow
-
intermediateOrderByColumns
private final int[] intermediateOrderByColumns -
intermediateOrderByDirection
private final int[] intermediateOrderByDirection -
intermediateOrderByNullsLow
private final boolean[] intermediateOrderByNullsLow -
rowsSeenLeft
private int rowsSeenLeft -
rowsSeenRight
private int rowsSeenRight -
rowsReturned
private int rowsReturned
-
-
Constructor Details
-
SetOpResultSet
SetOpResultSet(NoPutResultSet leftSource, NoPutResultSet rightSource, Activation activation, int resultSetNumber, long optimizerEstimatedRowCount, double optimizerEstimatedCost, int opType, boolean all, int intermediateOrderByColumnsSavedObject, int intermediateOrderByDirectionSavedObject, int intermediateOrderByNullsLowSavedObject)
-
-
Method Details
-
openCore
open the first source.- Specified by:
openCorein interfaceNoPutResultSet- Throws:
StandardException- thrown on failure
-
getNextRowCore
Description copied from interface:NoPutResultSetReturn the requested values computed from the next row (if any) for which the restriction evaluates to true.restriction and projection parameters are evaluated for each row.
- Specified by:
getNextRowCorein interfaceNoPutResultSet- Specified by:
getNextRowCorein classBasicNoPutResultSetImpl- Returns:
- the next row of the intersect or except, null if there is none
- Throws:
StandardException- thrown on failure- See Also:
-
advanceRightPastDuplicates
- Throws:
StandardException
-
compare
private int compare(DataValueDescriptor[] leftCols, DataValueDescriptor[] rightCols) throws StandardException - Throws:
StandardException
-
isDuplicate
- Throws:
StandardException
-
getCurrentRow
Description copied from interface:CursorResultSetReturns the current row of the result set. REMIND: eventually, this will only return the current row for result sets that need to return it; either some field in the activation or a parameter in the constructor will be used to signal that this needs to function. This will let us limit the number of live objects we are holding on to.- Specified by:
getCurrentRowin interfaceCursorResultSet- Returns:
- the last row returned by getNextRow. null if closed.
-
close
If the result set has been opened, close the currently open source.- Specified by:
closein interfaceResultSet- Overrides:
closein classNoPutResultSetImpl- Throws:
StandardException- thrown on error
-
finish
Description copied from interface:ResultSetTells the system that there will be no more access to any database information via this result set; in particular, no more calls to open(). Will close the result set if it is not already closed.- Specified by:
finishin interfaceResultSet- Overrides:
finishin classBasicNoPutResultSetImpl- Throws:
StandardException- on error
-
getTimeSpent
public long getTimeSpent(int type) Return the total amount of time spent in this ResultSet- Specified by:
getTimeSpentin interfaceResultSet- 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).
-
getRowLocation
Description copied from interface:CursorResultSetReturns the row location of the current base table row of the cursor. If this cursor's row is composed of multiple base tables' rows, i.e. due to a join, then a null is returned.- Specified by:
getRowLocationin interfaceCursorResultSet- Returns:
- the row location of the current cursor row.
- Throws:
StandardException- thrown on failure- See Also:
-
getOpType
public int getOpType()Return the set operation of thisSetOpResultSet- Returns:
- the set operation of this ResultSet, the value is either
IntersectOrExceptNode.INTERSECT_OPfor Intersect operation orIntersectOrExceptNode.EXCEPT_OPfor Except operation - See Also:
-
getResultSetNumber
public int getResultSetNumber()Return the result set number- Returns:
- the result set number
-
getLeftSourceInput
Return the left source input of thisSetOpResultSet- Returns:
- the left source input of this
SetOpResultSet - See Also:
-
getRightSourceInput
Return the right source input of thisSetOpResultSet- Returns:
- the right source input of this
SetOpResultSet - See Also:
-
getRowsSeenLeft
public int getRowsSeenLeft()Return the number of rows seen on the left source input- Returns:
- the number of rows seen on the left source input
-
getRowsSeenRight
public int getRowsSeenRight()Return the number of rows seen on the right source input- Returns:
- the number of rows seen on the right source input
-
getRowsReturned
public int getRowsReturned()Return the number of rows returned from the result set- Returns:
- the number of rows returned from the result set
-