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
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
FieldsModifier and TypeFieldDescriptionprivate ExecRow
private FormatableBitSet
private GeneratedMethod
long
Cumulative time needed to evaluate any restriction on this result set.private long
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
ConstructorsConstructorDescriptionWindowResultSet
(Activation activation, NoPutResultSet source, int rowAllocator, int resultSetNumber, int erdNumber, GeneratedMethod restriction, double optimizerEstimatedRowCount, double optimizerEstimatedCost) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
If the result set has been opened, close the open scan, else throw.private ExecRow
Cache the ExecRow for this result set.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
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 Details
-
restriction
-
source
Source result set, -
restrictionTime
public long restrictionTimeCumulative time needed to evaluate any restriction on this result set. -
referencedColumns
-
allocatedRow
-
rownumber
private long rownumber
-
-
Constructor Details
-
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 Details
-
openCore
Open this ResultSet.- Throws:
StandardException
- thrown if cursor finished.
-
reopenCore
Reopen this ResultSet.- Specified by:
reopenCore
in interfaceNoPutResultSet
- Overrides:
reopenCore
in classBasicNoPutResultSetImpl
- Throws:
StandardException
- thrown if cursor finished.- See Also:
-
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.
- 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:
-
close
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
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
Cache the ExecRow for this result set.- Returns:
- The cached ExecRow for this ResultSet
- Throws:
StandardException
- thrown on failure.
-