Class MaterializedResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.NoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.MaterializedResultSet
-
- All Implemented Interfaces:
CursorResultSet
,NoPutResultSet
,ResultSet
,RowLocationRetRowSource
,RowSource
class MaterializedResultSet extends NoPutResultSetImpl implements CursorResultSet
Materialize the underlying ResultSet tree into a temp table on the 1st open. Return rows from temp table on subsequent scans.
-
-
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 long
createTCTime
long
fetchTCTime
private boolean
fromSource
protected ConglomerateController
materializedCC
protected long
materializedCID
boolean
materializedCreated
private ExecRow
materializedRowBuffer
protected ScanController
materializedScan
NoPutResultSet
source
private boolean
sourceDrained
private TransactionController
tc
-
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 MaterializedResultSet(NoPutResultSet source, Activation activation, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
Constructor for a MaterializedResultSet
-
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.ExecRow
getCurrentRow()
Gets information from last getNextRow call.ExecRow
getNextRowCore()
Return the requested values computed from the next row (if any) for which the restriction evaluates to true.private ExecRow
getNextRowFromSource()
private ExecRow
getNextRowFromTempTable()
RowLocation
getRowLocation()
Gets information from its source.long
getTimeSpent(int type)
Return the total amount of time spent in this ResultSetvoid
openCore()
open a scan on the source. scan parameters are evaluated at each open, so there is probably some way of altering their values...void
reopenCore()
reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.derby.iapi.sql.ResultSet
addWarning, checkRowPosition, cleanUp, clearCurrentRow, finish, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
-
-
-
Field Detail
-
source
public NoPutResultSet source
-
materializedRowBuffer
private ExecRow materializedRowBuffer
-
materializedCID
protected long materializedCID
-
materializedCreated
public boolean materializedCreated
-
fromSource
private boolean fromSource
-
materializedCC
protected ConglomerateController materializedCC
-
materializedScan
protected ScanController materializedScan
-
tc
private TransactionController tc
-
sourceDrained
private boolean sourceDrained
-
createTCTime
public long createTCTime
-
fetchTCTime
public long fetchTCTime
-
-
Constructor Detail
-
MaterializedResultSet
public MaterializedResultSet(NoPutResultSet source, Activation activation, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException
Constructor for a MaterializedResultSet- Parameters:
source
- The NoPutResultSet from which to get rows to be materializedactivation
- The activation for this executionresultSetNumber
- The resultSetNumber- Throws:
StandardException
- on error
-
-
Method Detail
-
openCore
public void openCore() throws StandardException
open a scan on the source. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
openCore
in interfaceNoPutResultSet
- Throws:
StandardException
- thrown on failure
-
reopenCore
public void reopenCore() throws StandardException
reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- 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
Description copied from interface:NoPutResultSet
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- See Also:
NoPutResultSet.getNextRowCore()
-
getNextRowFromSource
private ExecRow getNextRowFromSource() throws StandardException
- Throws:
StandardException
-
getNextRowFromTempTable
private ExecRow getNextRowFromTempTable() throws StandardException
- Throws:
StandardException
-
close
public void close() throws StandardException
If the result set has been opened, close the open scan.- Specified by:
close
in interfaceResultSet
- Overrides:
close
in classNoPutResultSetImpl
- Throws:
StandardException
- thrown on error
-
getTimeSpent
public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet- Specified by:
getTimeSpent
in interfaceResultSet
- 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).
-
getRowLocation
public RowLocation getRowLocation() throws StandardException
Gets information from its source. We might want to have this take a CursorResultSet in its constructor some day, instead of doing a cast here?- Specified by:
getRowLocation
in interfaceCursorResultSet
- Returns:
- the row location of the current cursor row.
- Throws:
StandardException
- thrown on failure- See Also:
CursorResultSet
-
getCurrentRow
public ExecRow getCurrentRow()
Gets information from last getNextRow call.- Specified by:
getCurrentRow
in interfaceCursorResultSet
- Returns:
- the last row returned.
- See Also:
CursorResultSet
-
-