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

pack-priv Class WindowResultSet

extends NoPutResultSetImpl
Class Inheritance
Imports
org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.loader.GeneratedMethod, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.sql.execute.ExecRow, .NoPutResultSet, .ExecPreparedStatement, .ExecRowBuilder, org.apache.derby.iapi.types.DataValueDescriptor, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.io.FormatableBitSet

WindowResultSet This ResultSet handles a window function ResultSet. The ResultSet is opened using openCore(). Each row is fetched and any restrictions evaluated for each row in a do-while loop in getNextRowCore(). The ResultSet is closed using closeCore().

Field Summary

Modifier and TypeField and Description
private ExecRow
private FormatableBitSet
private GeneratedMethod
public long
restrictionTime

Cumulative time needed to evaluate any restriction on this result set.

private long
public NoPutResultSet
source

Source result set,

Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
checkNullColsclonedExecRowcncLenresultSetNumbertargetResultSet

Constructor Summary

AccessConstructor and Description
pack-priv
WindowResultSet(Activation
The activation
activation
,
NoPutResultSet
Source result set
source
,
int rowAllocator, int
The resultSetNumber
resultSetNumber
,
int
Int for ResultDescription (so it can be turned back into an object)
erdNumber
,
GeneratedMethod
Restriction
restriction
,
double
The optimizer's estimated number of rows.
optimizerEstimatedRowCount
,
double
The optimizer's estimated cost
optimizerEstimatedCost
)

Constructor

Method Summary

Modifier and TypeMethod and Description
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 open scan, else throw.

private ExecRow

Returns:

The cached ExecRow for this ResultSet
getAllocatedRow
()

Cache the ExecRow for this result set.

public ExecRow

Returns:

the next row in the result
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 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

public void
public void
populateFromSourceRow(ExecRow srcrow, ExecRow destrow)

Copy columns from srcrow into destrow, or insert ROW_NUMBER.

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

Field Detail

allocatedRowback to summary
private ExecRow allocatedRow
referencedColumnsback to summary
private FormatableBitSet referencedColumns
restrictionback to summary
private GeneratedMethod restriction
restrictionTimeback to summary
public long restrictionTime

Cumulative time needed to evaluate any restriction on this result set.

rownumberback to summary
private long rownumber
sourceback to summary
public NoPutResultSet source

Source result set,

Constructor Detail

WindowResultSetback to summary
pack-priv WindowResultSet(Activation activation, NoPutResultSet source, int rowAllocator, int resultSetNumber, int erdNumber, GeneratedMethod restriction, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException

Constructor

Parameters
activation:Activation

The activation

source:NoPutResultSet

Source result set

resultSetNumber:int

The resultSetNumber

erdNumber:int

Int for ResultDescription (so it can be turned back into an object)

restriction:GeneratedMethod

Restriction

optimizerEstimatedRowCount:double

The optimizer's estimated number of rows.

optimizerEstimatedCost:double

The optimizer's estimated cost

Method Detail

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 open scan, else throw.

Exceptions
StandardException:
thrown on error
getAllocatedRowback to summary
private ExecRow getAllocatedRow() throws StandardException

Cache the ExecRow for this result set.

Returns:ExecRow

The cached ExecRow for this ResultSet

Exceptions
StandardException:
thrown on failure.
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.

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 in the result

Exceptions
StandardException:
  • thrown on failure.
  • ResultSetNotOpen thrown if not yet open.
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).

openCoreback to summary
public void openCore() throws StandardException

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

Open this ResultSet.

Exceptions
StandardException:
thrown if cursor finished.
populateFromSourceRowback to summary
public void populateFromSourceRow(ExecRow srcrow, ExecRow destrow) throws StandardException

Copy columns from srcrow into destrow, or insert ROW_NUMBER.

FIXME This is temporary. Window function treatment needs to generalized to work for other window functions.

Exceptions
StandardException:
thrown on failure to open
reopenCoreback to summary
public void reopenCore() throws StandardException

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

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

Reopen this ResultSet.

Exceptions
StandardException:
thrown if cursor finished.