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 BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ExecRowprivate FormatableBitSetprivate GeneratedMethodlongCumulative time needed to evaluate any restriction on this result set.private longSource result set,Fields inherited from class NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSetFields inherited from class BasicNoPutResultSetImpl
activation, 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
ConstructorsConstructorDescriptionWindowResultSet(Activation activation, NoPutResultSet source, int rowAllocator, int resultSetNumber, int erdNumber, GeneratedMethod restriction, double optimizerEstimatedRowCount, double optimizerEstimatedCost) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()If the result set has been opened, close the open scan, else throw.private ExecRowCache the ExecRow for this result set.Return the requested values computed from the next row (if any) for which the restriction evaluates to true.longgetTimeSpent(int type) Return the total amount of time spent in this ResultSetvoidopenCore()Open this ResultSet.voidpopulateFromSourceRow(ExecRow srcrow, ExecRow destrow) Copy columns from srcrow into destrow, or insert ROW_NUMBER.voidReopen this ResultSet.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, 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:
reopenCorein interfaceNoPutResultSet- Overrides:
reopenCorein 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:
getNextRowCorein interfaceNoPutResultSet- Specified by:
getNextRowCorein 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:
closein interfaceResultSet- Overrides:
closein 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.
-