Class HashTableResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.NoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.HashTableResultSet
-
- All Implemented Interfaces:
CursorResultSet,NoPutResultSet,ResultSet,RowLocationRetRowSource,RowSource
class HashTableResultSet extends NoPutResultSetImpl implements CursorResultSet
Builds a hash table on the underlying result set tree.
-
-
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 java.util.ListentryVectorprivate intentryVectorSizeprivate booleanfirstIntoHashtableprivate booleanfirstNextprivate booleanhashTableBuiltinthashtableSizeprivate BackingStoreHashtablehtprivate intinitialCapacityint[]keyColumnsprivate floatloadFactorprivate ExecRowmappedResultRowprivate longmaxInMemoryRowCountprivate ExecRownextCandidateQualifier[][]nextQualifiersprivate intnumFetchedOnNextprivate GeneratedMethodprojectionlongprojectionTimeprivate int[]projectMappingprivate ExecRowprojRowprivate booleanremoveDuplicateslongrestrictionTimebooleanreuseResultprivate booleanrunTimeStatsOnjava.util.PropertiesscanPropertiesGeneratedMethodsingleTableRestrictionprivate booleanskipNullKeyColumnsNoPutResultSetsource-
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 HashTableResultSet(NoPutResultSet s, Activation a, GeneratedMethod str, Qualifier[][] nextQualifiers, GeneratedMethod p, int resultSetNumber, int mapRefItem, boolean reuseResult, int keyColItem, boolean removeDuplicates, long maxInMemoryRowCount, int initialCapacity, float loadFactor, boolean skipNullKeyColumns, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()If the result set has been opened, close the open scan.private ExecRowdoProjection(ExecRow sourceRow)Do the projection against the source row.ExecRowgetCurrentRow()Gets last row returned.ExecRowgetNextRowCore()Return the requested values computed from the next row (if any) for which the restriction evaluates to true.DataValueDescriptor[]getNextRowFromRowSource()Get the next row as an array of column objects.RowLocationgetRowLocation()Gets information from its source.longgetTimeSpent(int type)Return the total amount of time spent in this ResultSetbooleanisForUpdate()Is this ResultSet or it's source result set for updatevoidopenCore()open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...voidreopenCore()reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...private voidresetProbeVariables()-
Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getResultDescription, getValidColumns, 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
-
restrictionTime
public long restrictionTime
-
projectionTime
public long projectionTime
-
hashtableSize
public int hashtableSize
-
scanProperties
public java.util.Properties scanProperties
-
source
public NoPutResultSet source
-
singleTableRestriction
public GeneratedMethod singleTableRestriction
-
nextQualifiers
public Qualifier[][] nextQualifiers
-
projection
private GeneratedMethod projection
-
projectMapping
private int[] projectMapping
-
runTimeStatsOn
private boolean runTimeStatsOn
-
mappedResultRow
private ExecRow mappedResultRow
-
reuseResult
public boolean reuseResult
-
keyColumns
public int[] keyColumns
-
removeDuplicates
private boolean removeDuplicates
-
maxInMemoryRowCount
private long maxInMemoryRowCount
-
initialCapacity
private int initialCapacity
-
loadFactor
private float loadFactor
-
skipNullKeyColumns
private boolean skipNullKeyColumns
-
firstNext
private boolean firstNext
-
numFetchedOnNext
private int numFetchedOnNext
-
entryVectorSize
private int entryVectorSize
-
entryVector
private java.util.List entryVector
-
hashTableBuilt
private boolean hashTableBuilt
-
firstIntoHashtable
private boolean firstIntoHashtable
-
nextCandidate
private ExecRow nextCandidate
-
projRow
private ExecRow projRow
-
ht
private BackingStoreHashtable ht
-
-
Constructor Detail
-
HashTableResultSet
HashTableResultSet(NoPutResultSet s, Activation a, GeneratedMethod str, Qualifier[][] nextQualifiers, GeneratedMethod p, int resultSetNumber, int mapRefItem, boolean reuseResult, int keyColItem, boolean removeDuplicates, long maxInMemoryRowCount, int initialCapacity, float loadFactor, boolean skipNullKeyColumns, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException
- Throws:
StandardException
-
-
Method Detail
-
openCore
public void openCore() throws StandardExceptionopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
openCorein interfaceNoPutResultSet- Throws:
StandardException- thrown if cursor finished.
-
reopenCore
public void reopenCore() throws StandardExceptionreopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
reopenCorein interfaceNoPutResultSet- Overrides:
reopenCorein classBasicNoPutResultSetImpl- Throws:
StandardException- thrown if cursor finished.- See Also:
NoPutResultSet.openCore()
-
resetProbeVariables
private void resetProbeVariables() throws StandardException- Throws:
StandardException
-
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:
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:
NoPutResultSet.getNextRowCore()
-
getTimeSpent
public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet- Specified by:
getTimeSpentin 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).
-
close
public void close() throws StandardExceptionIf the result set has been opened, close the open scan.- Specified by:
closein interfaceResultSet- Overrides:
closein classNoPutResultSetImpl- Throws:
StandardException- thrown on error
-
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:
getRowLocationin interfaceCursorResultSet- Returns:
- the row location of the current cursor row.
- Throws:
StandardException- thrown on failure.- See Also:
CursorResultSet
-
getCurrentRow
public ExecRow getCurrentRow() throws StandardException
Gets last row returned.- Specified by:
getCurrentRowin interfaceCursorResultSet- Returns:
- the last row returned.
- Throws:
StandardException- thrown on failure.- See Also:
CursorResultSet
-
doProjection
private ExecRow doProjection(ExecRow sourceRow) throws StandardException
Do the projection against the source row. Use reflection where necessary, otherwise get the source column into our result row.- Parameters:
sourceRow- The source row.- Returns:
- The result of the projection
- Throws:
StandardException- thrown on failure.
-
getNextRowFromRowSource
public DataValueDescriptor[] getNextRowFromRowSource() throws StandardException
Description copied from interface:RowSourceGet the next row as an array of column objects. The column objects can be a JBMS Storable or any Serializable/Externalizable/Formattable/Streaming type.
A return of null indicates that the complete set of rows has been read.A null column can be specified by leaving the object null, or indicated by returning a non-null getValidColumns. On streaming columns, it can be indicated by returning a non-null get FieldStates.
If RowSource.needToClone() is true then the returned row (the DataValueDescriptor[]) is guaranteed not to be modified by drainer of the RowSource (except that the input stream will be read, of course) and drainer will keep no reference to it before making the subsequent nextRow call. So it is safe to return the same DataValueDescriptor[] in subsequent nextRow calls if that is desirable for performance reasons.
If RowSource.needToClone() is false then the returned row (the DataValueDescriptor[]) may be be modified by drainer of the RowSource, and the drainer may keep a reference to it after making the subsequent nextRow call. In this case the client should severe all references to the row after returning it from getNextRowFromRowSource().
- Specified by:
getNextRowFromRowSourcein interfaceRowSource- Overrides:
getNextRowFromRowSourcein classNoPutResultSetImpl- Throws:
StandardException- on error- See Also:
RowSource.getNextRowFromRowSource()
-
isForUpdate
public boolean isForUpdate()
Is this ResultSet or it's source result set for update- Specified by:
isForUpdatein interfaceNoPutResultSet- Overrides:
isForUpdatein classNoPutResultSetImpl- Returns:
- Whether or not the result set is for update.
-
-