Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

pack-priv Class SetOpResultSet

extends NoPutResultSetImpl
implements CursorResultSet
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.execute.CursorResultSet, org.apache.derby.iapi.sql.ResultSet
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.sql.execute.CursorResultSet, .ExecPreparedStatement, .ExecRow, .NoPutResultSet, org.apache.derby.iapi.types.DataValueDescriptor, .Orderable, .RowLocation, org.apache.derby.impl.sql.compile.IntersectOrExceptNode

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.

Field Summary

Modifier and TypeField and Description
private final Activation
private final boolean
private final int[]
private final int[]
private final boolean[]
private ExecRow
private final NoPutResultSet
private final int
private DataValueDescriptor[]
private final int
private ExecRow
private final NoPutResultSet
private int
private int
private int
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
checkNullColsclonedExecRowcncLentargetResultSet

Constructor Summary

AccessConstructor and Description
pack-priv
SetOpResultSet(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 TypeMethod and Description
private void
public void
close()

Overrides org.apache.derby.impl.sql.execute.NoPutResultSetImpl.close.

Implements org.apache.derby.iapi.sql.ResultSet.close.

If the result set has been opened, close the currently open source.

private int
public void
finish()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finish.

Implements org.apache.derby.iapi.sql.ResultSet.finish.

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().

public ExecRow
getCurrentRow()

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

Returns the current row of the result set.

public NoPutResultSet

Returns:

the left source input of this SetOpResultSet
getLeftSourceInput
()

Return the left source input of this SetOpResultSet

public ExecRow

Returns:

the next row of the intersect or except, null if there is none
getNextRowCore
()

Implements abstract org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRowCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.getNextRowCore.

Return the requested values computed from the next row (if any) for which the restriction evaluates to true.

public int

Returns:

the set operation of this ResultSet, the value is either IntersectOrExceptNode.INTERSECT_OP for Intersect operation or IntersectOrExceptNode.EXCEPT_OP for Except operation
getOpType
()

Return the set operation of this SetOpResultSet

public int

Returns:

the result set number
getResultSetNumber
()

Return the result set number

public NoPutResultSet

Returns:

the right source input of this SetOpResultSet
getRightSourceInput
()

Return the right source input of this SetOpResultSet

public RowLocation

Returns:

the row location of the current cursor row.
getRowLocation
()

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

Returns the row location of the current base table row of the cursor.

public int

Returns:

the number of rows returned from the result set
getRowsReturned
()

Return the number of rows returned from the result set

public int

Returns:

the number of rows seen on the left source input
getRowsSeenLeft
()

Return the number of rows seen on the left source input

public int

Returns:

the number of rows seen on the right source input
getRowsSeenRight
()

Return the number of rows seen on the right source input

public long

Returns:

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

Implements org.apache.derby.iapi.sql.ResultSet.getTimeSpent.

Return the total amount of time spent in this ResultSet

private boolean
public void
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
clearCurrentRowclearOrderableCachecloseRowSourcegetCursorNamegetNextRowFromRowSourcegetResultDescriptiongetValidColumnsisForUpdatemarkRowAsDeletedneedsRowLocationneedsRowLocationForDeferredCheckConstraintsneedsToCloneoffendingRowLocationpositionScanAtRowLocationprintQualifiersresultSetNumberrowLocationsetCurrentRowsetHasDeferrableCheckssetNeedsRowLocationsetTargetResultSetskipRowskipScanunpackHashValueupdateRow

Field Detail

activationback to summary
private final Activation activation

Hides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.activation.

allback to summary
private final boolean all
intermediateOrderByColumnsback to summary
private final int[] intermediateOrderByColumns
intermediateOrderByDirectionback to summary
private final int[] intermediateOrderByDirection
intermediateOrderByNullsLowback to summary
private final boolean[] intermediateOrderByNullsLow
leftInputRowback to summary
private ExecRow leftInputRow
leftSourceback to summary
private final NoPutResultSet leftSource
opTypeback to summary
private final int opType
prevColsback to summary
private DataValueDescriptor[] prevCols
resultSetNumberback to summary
private final int resultSetNumber

Hides org.apache.derby.impl.sql.execute.NoPutResultSetImpl.resultSetNumber.

rightInputRowback to summary
private ExecRow rightInputRow
rightSourceback to summary
private final NoPutResultSet rightSource
rowsReturnedback to summary
private int rowsReturned
rowsSeenLeftback to summary
private int rowsSeenLeft
rowsSeenRightback to summary
private int rowsSeenRight

Constructor Detail

SetOpResultSetback to summary
pack-priv SetOpResultSet(NoPutResultSet leftSource, NoPutResultSet rightSource, Activation activation, int resultSetNumber, long optimizerEstimatedRowCount, double optimizerEstimatedCost, int opType, boolean all, int intermediateOrderByColumnsSavedObject, int intermediateOrderByDirectionSavedObject, int intermediateOrderByNullsLowSavedObject)

Method Detail

advanceRightPastDuplicatesback to summary
private void advanceRightPastDuplicates(DataValueDescriptor[] leftColumns) throws StandardException
closeback to summary
public void close() throws StandardException

Overrides org.apache.derby.impl.sql.execute.NoPutResultSetImpl.close.

Implements org.apache.derby.iapi.sql.ResultSet.close.

If the result set has been opened, close the currently open source.

Exceptions
StandardException:
thrown on error
compareback to summary
private int compare(DataValueDescriptor[] leftCols, DataValueDescriptor[] rightCols) throws StandardException
finishback to summary
public void finish() throws StandardException

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finish.

Implements org.apache.derby.iapi.sql.ResultSet.finish.

Doc from org.apache.derby.iapi.sql.ResultSet.finish.

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(). Will close the result set if it is not already closed.

Exceptions
StandardException:
on error
getCurrentRowback to summary
public ExecRow getCurrentRow()

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

Doc from org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

Returns 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.

Returns:ExecRow

the last row returned by getNextRow. null if closed.

getLeftSourceInputback to summary
public NoPutResultSet getLeftSourceInput()

Return the left source input of this SetOpResultSet

Returns:NoPutResultSet

the left source input of this SetOpResultSet

See Also
org.apache.derby.iapi.sql.execute.NoPutResultSet
getNextRowCoreback to summary
public ExecRow getNextRowCore() throws StandardException

Implements abstract org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRowCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.getNextRowCore.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.getNextRowCore.

Return 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.

Returns:ExecRow

the next row of the intersect or except, null if there is none

Exceptions
StandardException:
thrown on failure
getOpTypeback to summary
public int getOpType()

Return the set operation of this SetOpResultSet

Returns:int

the set operation of this ResultSet, the value is either IntersectOrExceptNode.INTERSECT_OP for Intersect operation or IntersectOrExceptNode.EXCEPT_OP for Except operation

See Also
org.apache.derby.impl.sql.compile.IntersectOrExceptNode
getResultSetNumberback to summary
public int getResultSetNumber()

Return the result set number

Returns:int

the result set number

getRightSourceInputback to summary
public NoPutResultSet getRightSourceInput()

Return the right source input of this SetOpResultSet

Returns:NoPutResultSet

the right source input of this SetOpResultSet

See Also
org.apache.derby.iapi.sql.execute.NoPutResultSet
getRowLocationback to summary
public RowLocation getRowLocation() throws StandardException

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

Doc from org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

Returns 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.

Returns:RowLocation

the row location of the current cursor row.

Exceptions
StandardException:
thrown on failure
See Also
CursorResultSet
getRowsReturnedback to summary
public int getRowsReturned()

Return the number of rows returned from the result set

Returns:int

the number of rows returned from the result set

getRowsSeenLeftback to summary
public int getRowsSeenLeft()

Return the number of rows seen on the left source input

Returns:int

the number of rows seen on the left source input

getRowsSeenRightback to summary
public int getRowsSeenRight()

Return the number of rows seen on the right source input

Returns:int

the number of rows seen on the right source input

getTimeSpentback to summary
public long getTimeSpent(int type)

Implements org.apache.derby.iapi.sql.ResultSet.getTimeSpent.

Return the total amount of time spent in this ResultSet

Parameters
type:int

CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.

Returns:long

long The total amount of time spent (in milliseconds).

isDuplicateback to summary
private boolean isDuplicate(DataValueDescriptor[] curColumns) throws StandardException
openCoreback to summary
public void openCore() throws StandardException

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.openCore.

open the first source.

Exceptions
StandardException:
thrown on failure