Class WindowResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.NoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.WindowResultSet
-
- All Implemented Interfaces:
NoPutResultSet
,ResultSet
,RowLocationRetRowSource
,RowSource
class WindowResultSet extends NoPutResultSetImpl
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().
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator
-
-
Field Summary
Fields Modifier and Type Field Description private ExecRow
allocatedRow
private FormatableBitSet
referencedColumns
private GeneratedMethod
restriction
long
restrictionTime
Cumulative time needed to evaluate any restriction on this result set.private long
rownumber
NoPutResultSet
source
Source result set,-
Fields inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSet
-
Fields inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArray
-
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBER
-
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
-
-
Constructor Summary
Constructors Constructor Description WindowResultSet(Activation activation, NoPutResultSet source, int rowAllocator, int resultSetNumber, int erdNumber, GeneratedMethod restriction, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
If the result set has been opened, close the open scan, else throw.private ExecRow
getAllocatedRow()
Cache the ExecRow for this result set.ExecRow
getNextRowCore()
Return the requested values computed from the next row (if any) for which the restriction evaluates to true.long
getTimeSpent(int type)
Return the total amount of time spent in this ResultSetvoid
openCore()
Open this ResultSet.void
populateFromSourceRow(ExecRow srcrow, ExecRow destrow)
Copy columns from srcrow into destrow, or insert ROW_NUMBER.void
reopenCore()
Reopen this ResultSet.-
Methods inherited from class org.apache.derby.impl.sql.execute.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, updateRow
-
Methods inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, childrenToXML, cleanUp, dumpTimeStats, finish, 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, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXML, toXML
-
-
-
-
Field Detail
-
restriction
private GeneratedMethod restriction
-
source
public NoPutResultSet source
Source result set,
-
restrictionTime
public long restrictionTime
Cumulative time needed to evaluate any restriction on this result set.
-
referencedColumns
private FormatableBitSet referencedColumns
-
allocatedRow
private ExecRow allocatedRow
-
rownumber
private long rownumber
-
-
Constructor Detail
-
WindowResultSet
WindowResultSet(Activation activation, NoPutResultSet source, int rowAllocator, int resultSetNumber, int erdNumber, GeneratedMethod restriction, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException
Constructor- Parameters:
activation
- The activationsource
- Source result setrowAllocator
-resultSetNumber
- The resultSetNumbererdNumber
- Int for ResultDescription (so it can be turned back into an object)restriction
- RestrictionoptimizerEstimatedRowCount
- The optimizer's estimated number of rows.optimizerEstimatedCost
- The optimizer's estimated cost- Throws:
StandardException
-
-
Method Detail
-
openCore
public void openCore() throws StandardException
Open this ResultSet.- Throws:
StandardException
- thrown if cursor finished.
-
reopenCore
public void reopenCore() throws StandardException
Reopen this ResultSet.- Specified by:
reopenCore
in interfaceNoPutResultSet
- Overrides:
reopenCore
in classBasicNoPutResultSetImpl
- Throws:
StandardException
- thrown if cursor finished.- See Also:
NoPutResultSet.openCore()
-
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 and projection parameters are evaluated for each row.
- Specified by:
getNextRowCore
in interfaceNoPutResultSet
- Specified by:
getNextRowCore
in classBasicNoPutResultSetImpl
- Returns:
- the next row in the result
- Throws:
StandardException
- thrown on failure.StandardException
- ResultSetNotOpen thrown if not yet open.- See Also:
NoPutResultSet.getNextRowCore()
-
close
public void close() throws StandardException
If the result set has been opened, close the open scan, else throw.- Specified by:
close
in interfaceResultSet
- Overrides:
close
in classNoPutResultSetImpl
- Throws:
StandardException
- thrown on error
-
populateFromSourceRow
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.- Throws:
StandardException
- thrown on failure to open
-
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).
-
getAllocatedRow
private ExecRow getAllocatedRow() throws StandardException
Cache the ExecRow for this result set.- Returns:
- The cached ExecRow for this ResultSet
- Throws:
StandardException
- thrown on failure.
-
-