Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

pack-priv Class BulkTableScanResultSet

extends TableScanResultSet
implements CursorResultSet
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.execute.CursorResultSet, org.apache.derby.iapi.sql.ResultSet
Imports
org.apache.derby.iapi.sql.execute.CursorResultSet, .ExecRow, .ExecIndexRow, .NoPutResultSet, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.types.RowLocation, .DataValueDescriptor, .RowLocation, org.apache.derby.iapi.sql.ResultSet, .Activation, org.apache.derby.iapi.store.access.GroupFetchScanController, .Qualifier, .ScanController, .StaticCompiledOpenConglomInfo, .TransactionController, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.loader.GeneratedMethod, org.apache.derby.iapi.services.io.FormatableBitSet

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.

Field Summary

Modifier and TypeField and Description
private int
private int
private int
private static int
private int
private DataValueDescriptor[][]
private RowLocation[]
Inherited from org.apache.derby.impl.sql.execute.TableScanResultSet:
coarserLockconglomIdcurrentRowIsValiddcocifirstScanforUpdateindexColsisConstraintisKeyednextDoneoneRowScanpast2FutureTblqualifiersqualifyrowsPerReadrowsThisScanrunTimeStatisticsOnsameStartStopPositionscanControllerscanControllerOpenedscanRepositionedscocistartKeyGetterstartPositionstartPositionStringstartSearchOperatorstopKeyGetterstopPositionstopPositionStringstopSearchOperatoruserSuppliedOptimizerOverrides

Constructor Summary

AccessConstructor and Description
pack-priv
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)

Constructor.

Method Summary

Modifier and TypeMethod and Description
private static int

Returns:

the bulk fetch size to use
adjustBulkFetchSize
(Activation
the activation for the executing statement
activation
,
int
how many rows to read in each chunk if a bulk fetch is OK to use
rowsPerRead
,
boolean
whether or not bulk fetch should be disabled for holdable cursors
disableForHoldable
)

Adjust the bulk fetch size according to the parameters.

protected boolean
canGetInstantaneousLocks()

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.canGetInstantaneousLocks.

Can we get instantaneous locks when getting share row locks at READ COMMITTED.

public void
close()

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.close.

Implements org.apache.derby.iapi.sql.ResultSet.close.

If the result set has been opened, close the open scan.

public ExecRow
private DataValueDescriptor[]
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.

public void
protected void
openScanController(TransactionController
transaction controller will open one if null
tc
)

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.openScanController.

Open the scan controller

private int
public void
public boolean
Inherited from org.apache.derby.impl.sql.execute.TableScanResultSet:
clonegetCurrentRowgetRowLocationgetScanPropertiesgetTimeSpentinitStartAndStopKeyisForUpdateloopControlpositionScanAtRowLocationprintStartPositionprintStopPositionreopenScanControllersetRowCountIfPossible

Field Detail

baseColumnCountback to summary
private int baseColumnCount
curRowPositionback to summary
private int curRowPosition
numRowsInArrayback to summary
private int numRowsInArray
OUT_OF_ROWSback to summary
private static int OUT_OF_ROWS
resultColumnCountback to summary
private int resultColumnCount
rowArrayback to summary
private DataValueDescriptor[][] rowArray
rowLocationsback to summary
private RowLocation[] rowLocations

Constructor Detail

BulkTableScanResultSetback to summary
pack-priv 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

Exceptions
StandardException:
thrown on failure to open
See Also
org.apache.derby.iapi.sql.execute.ResultSetFactory#getBulkTableScanResultSet

Method Detail

adjustBulkFetchSizeback to summary
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:Activation

the activation for the executing statement

rowsPerRead:int

how many rows to read in each chunk if a bulk fetch is OK to use

disableForHoldable:boolean

whether or not bulk fetch should be disabled for holdable cursors

Returns:int

the bulk fetch size to use

canGetInstantaneousLocksback to summary
protected boolean canGetInstantaneousLocks()

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.canGetInstantaneousLocks.

Can we get instantaneous locks when getting share row locks at READ COMMITTED.

closeback to summary
public void close() throws StandardException

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.close.

Implements org.apache.derby.iapi.sql.ResultSet.close.

If the result set has been opened, close the open scan. Delegate most of the work to TableScanResultSet.

Exceptions
StandardException:
on error
getNextRowCoreback to summary
public ExecRow getNextRowCore() throws StandardException

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.getNextRowCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.getNextRowCore.

Return the next row (if any) from the scan (if open). Reload the rowArray as necessary.

Returns:ExecRow

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.getNextRowCore.

the next row in the result

Exceptions
StandardException:
thrown on failure to get next row
lopOffRowLocationback to summary
private DataValueDescriptor[] lopOffRowLocation() throws StandardException

Get a blank row by cloning the candidate row and lopping off the trailing RowLocation column for scans done on behalf of MERGE statements.

openCoreback to summary
public void openCore() throws StandardException

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.openCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.openCore.

Open up the result set. Delegate most work to TableScanResultSet.openCore(). Create a new array with rows for use in fetchNextGroup().

Exceptions
StandardException:
thrown on failure to open
openScanControllerback to summary
protected void openScanController(TransactionController tc) throws StandardException

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.openScanController.

Open the scan controller

Parameters
tc:TransactionController

transaction controller will open one if null

Exceptions
StandardException:
thrown on failure to open
reloadArrayback to summary
private int reloadArray() throws StandardException
reopenCoreback to summary
public void reopenCore() throws StandardException

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.reopenCore.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.reopenCore.

Reopen the result set. Delegate most work to TableScanResultSet.reopenCore(). Reuse the array of rows.

Exceptions
StandardException:
thrown on failure to open
requiresRelockingback to summary
public boolean requiresRelocking()

Overrides org.apache.derby.impl.sql.execute.TableScanResultSet.requiresRelocking.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.requiresRelocking.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.requiresRelocking.

Do we need to relock the row when going to the heap.

Returns:boolean

Whether or not we need to relock the row when going to the heap.

See Also
NoPutResultSet#requiresRelocking