Class BulkTableScanResultSet
java.lang.Object
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
org.apache.derby.impl.sql.execute.NoPutResultSetImpl
org.apache.derby.impl.sql.execute.ScanResultSet
org.apache.derby.impl.sql.execute.TableScanResultSet
org.apache.derby.impl.sql.execute.BulkTableScanResultSet
- All Implemented Interfaces:
Cloneable
,CursorResultSet
,NoPutResultSet
,ResultSet
,RowLocationRetRowSource
,RowSource
Read a base table or index in bulk. Most of the
work for this method is inherited from TableScanResultSet.
This class overrides getNextRowCore (and extends
re/openCore) to use a row array and fetch rows
from the Store in bulk (using fetchNextGroup).
Since it retrieves rows in bulk, locking is not as is usual -- locks may have already been released on rows as they are returned to the user. Hence, this ResultSet is not suitable for a query running Isolation Level 1, cursor stability.
Note that this code is only accessable from an optimizer override. If it makes sense to have the optimizer select bulk reads, then this should probably be rolled into TableScanResultSet.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private int
private int
private static int
private int
private DataValueDescriptor[][]
private RowLocation[]
Fields inherited from class org.apache.derby.impl.sql.execute.TableScanResultSet
coarserLock, conglomId, currentRowIsValid, dcoci, firstScan, forUpdate, indexCols, isConstraint, isKeyed, nextDone, oneRowScan, past2FutureTbl, qualifiers, qualify, rowsPerRead, rowsThisScan, runTimeStatisticsOn, sameStartStopPosition, scanController, scanControllerOpened, scanRepositioned, scoci, startKeyGetter, startPosition, startPositionString, startSearchOperator, stopKeyGetter, stopPosition, stopPositionString, stopSearchOperator, userSuppliedOptimizerOverrides
Fields inherited from class org.apache.derby.impl.sql.execute.ScanResultSet
accessedCols, candidate, fetchRowLocations, indexName, isolationLevel, lockMode, resultRowBuilder, tableName
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
ConstructorsConstructorDescriptionBulkTableScanResultSet
(long conglomId, StaticCompiledOpenConglomInfo scoci, Activation activation, int resultRowTemplate, int resultSetNumber, GeneratedMethod startKeyGetter, int startSearchOperator, GeneratedMethod stopKeyGetter, int stopSearchOperator, boolean sameStartStopPosition, Qualifier[][] qualifiers, String tableName, String userSuppliedOptimizerOverrides, String indexName, boolean isConstraint, boolean forUpdate, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int rowsPerRead, boolean disableForHoldable, boolean oneRowScan, double optimizerEstimatedRowCount, double optimizerEstimatedCost) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
adjustBulkFetchSize
(Activation activation, int rowsPerRead, boolean disableForHoldable) Adjust the bulk fetch size according to the parameters.protected boolean
Can we get instantaneous locks when getting share row locks at READ COMMITTED.void
close()
If the result set has been opened, close the open scan.Return the next row (if any) from the scan (if open).private DataValueDescriptor[]
Get a blank row by cloning the candidate row and lopping off the trailing RowLocation column for scans done on behalf of MERGE statements.void
openCore()
Open up the result set.protected void
Open the scan controllerprivate int
void
Reopen the result set.boolean
Do we need to relock the row when going to the heap.Methods inherited from class org.apache.derby.impl.sql.execute.TableScanResultSet
clone, getCurrentRow, getRowLocation, getScanProperties, getTimeSpent, initStartAndStopKey, isForUpdate, loopControl, positionScanAtRowLocation, printStartPosition, printStopPosition, reopenScanController, setRowCountIfPossible
Methods inherited from class org.apache.derby.impl.sql.execute.ScanResultSet
getScanIsolationLevel, initIsolationLevel, setRowLocationsState, toXML
Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, markRowAsDeleted, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, 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, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXML
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.derby.iapi.sql.execute.CursorResultSet
getCurrentRow, getRowLocation
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, getTimeSpent, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
Field Details
-
rowArray
-
rowLocations
-
curRowPosition
private int curRowPosition -
numRowsInArray
private int numRowsInArray -
baseColumnCount
private int baseColumnCount -
resultColumnCount
private int resultColumnCount -
OUT_OF_ROWS
private static int OUT_OF_ROWS
-
-
Constructor Details
-
BulkTableScanResultSet
BulkTableScanResultSet(long conglomId, StaticCompiledOpenConglomInfo scoci, Activation activation, int resultRowTemplate, int resultSetNumber, GeneratedMethod startKeyGetter, int startSearchOperator, GeneratedMethod stopKeyGetter, int stopSearchOperator, boolean sameStartStopPosition, Qualifier[][] qualifiers, String tableName, String userSuppliedOptimizerOverrides, String indexName, boolean isConstraint, boolean forUpdate, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int rowsPerRead, boolean disableForHoldable, boolean oneRowScan, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException Constructor. Just save off the rowsPerRead argument and pass everything else down to TableScanResultSet- Throws:
StandardException
- thrown on failure to open- See Also:
-
-
Method Details
-
adjustBulkFetchSize
private static int adjustBulkFetchSize(Activation activation, int rowsPerRead, boolean disableForHoldable) Adjust the bulk fetch size according to the parameters. Bulk fetch may be disabled by returning 1 from this method. Disabling of bulk fetch may happen if the cursor is holdable and it contains LOB columns (DERBY-1511) because- Parameters:
activation
- the activation for the executing statementrowsPerRead
- how many rows to read in each chunk if a bulk fetch is OK to usedisableForHoldable
- whether or not bulk fetch should be disabled for holdable cursors- Returns:
- the bulk fetch size to use
-
openScanController
Open the scan controller- Overrides:
openScanController
in classTableScanResultSet
- Parameters:
tc
- transaction controller will open one if null- Throws:
StandardException
- thrown on failure to open
-
openCore
Open up the result set. Delegate most work to TableScanResultSet.openCore(). Create a new array withrows for use in fetchNextGroup(). - Specified by:
openCore
in interfaceNoPutResultSet
- Overrides:
openCore
in classTableScanResultSet
- Throws:
StandardException
- thrown on failure to open
-
lopOffRowLocation
Get a blank row by cloning the candidate row and lopping off the trailing RowLocation column for scans done on behalf of MERGE statements.- Throws:
StandardException
-
reopenCore
Reopen the result set. Delegate most work to TableScanResultSet.reopenCore(). Reuse the array of rows.- Specified by:
reopenCore
in interfaceNoPutResultSet
- Overrides:
reopenCore
in classTableScanResultSet
- Throws:
StandardException
- thrown on failure to open- See Also:
-
getNextRowCore
Return the next row (if any) from the scan (if open). Reload the rowArray as necessary.- Specified by:
getNextRowCore
in interfaceNoPutResultSet
- Overrides:
getNextRowCore
in classTableScanResultSet
- Returns:
- the next row in the result
- Throws:
StandardException
- thrown on failure to get next row- See Also:
-
reloadArray
- Throws:
StandardException
-
close
If the result set has been opened, close the open scan. Delegate most of the work to TableScanResultSet.- Specified by:
close
in interfaceResultSet
- Overrides:
close
in classTableScanResultSet
- Throws:
StandardException
- on error
-
canGetInstantaneousLocks
protected boolean canGetInstantaneousLocks()Can we get instantaneous locks when getting share row locks at READ COMMITTED.- Overrides:
canGetInstantaneousLocks
in classTableScanResultSet
-
requiresRelocking
public boolean requiresRelocking()Description copied from interface:NoPutResultSet
Do we need to relock the row when going to the heap.- Specified by:
requiresRelocking
in interfaceNoPutResultSet
- Overrides:
requiresRelocking
in classTableScanResultSet
- Returns:
- Whether or not we need to relock the row when going to the heap.
- See Also:
-