Class MergeScanRowSource
- All Implemented Interfaces:
ScanControllerRowSource, ScanManager, GenericScanController, GroupFetchScanController, RowCountable, RowLocationRetRowSource, RowSource, ScanController, ScanInfo
-
Field Summary
Fields inherited from class MergeScan
mergeRuns, openScans, sortBufferFields inherited from interface ScanController
GE, GT, NA -
Constructor Summary
ConstructorsConstructorDescriptionMergeScanRowSource(MergeSort sort, TransactionManager tran, SortBuffer sortBuffer, Vector<Long> mergeRuns, SortObserver sortObserver, boolean hold) -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the row source - implemented by MergeScan alreadyGet the next row as an array of column objects.All columns are always set from a sorterbooleanneedsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource.booleanbooleanDoes the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row.booleannext()Move to the next position in the scan.voidoffendingRowLocation(RowLocation rl, long containdId) voidrowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource.Methods inherited from class MergeScan
close, closeForEndTransaction, init, mergeARowMethods inherited from class SortScan
fetch, fetchNext, fetchWithoutQualifyMethods inherited from class Scan
delete, didNotQualify, doesCurrentPositionQualify, fetchLocation, fetchNextGroup, fetchNextGroup, fetchSet, getAllScanInfo, getEstimatedRowCount, getScanInfo, isCurrentPositionDeleted, isHeldAfterCommit, isKeyed, isTableLocked, newRowLocationTemplate, positionAtRowLocation, reopenScan, reopenScanByRowLocation, replace, setEstimatedRowCountMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GenericScanController
close, getScanInfo, isKeyed, isTableLocked, newRowLocationTemplate, reopenScan, reopenScanByRowLocationMethods inherited from interface RowCountable
getEstimatedRowCount, setEstimatedRowCountMethods inherited from interface ScanController
delete, didNotQualify, doesCurrentPositionQualify, fetch, fetchLocation, fetchNext, fetchWithoutQualify, isCurrentPositionDeleted, isHeldAfterCommit, positionAtRowLocation, replace
-
Constructor Details
-
MergeScanRowSource
MergeScanRowSource(MergeSort sort, TransactionManager tran, SortBuffer sortBuffer, Vector<Long> mergeRuns, SortObserver sortObserver, boolean hold)
-
-
Method Details
-
next
Description copied from class:MergeScanMove to the next position in the scan.- Specified by:
nextin interfaceGroupFetchScanController- Specified by:
nextin interfaceScanController- Overrides:
nextin classMergeScan- Returns:
- True if there is a next position in the scan, false if there isn't.
- Throws:
StandardException- Standard exception policy.- See Also:
-
getNextRowFromRowSource
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- Throws:
StandardException- Standard Derby Error Policy
-
needsRowLocation
public boolean needsRowLocation()Description copied from interface:RowLocationRetRowSourceneedsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource.- Specified by:
needsRowLocationin interfaceRowLocationRetRowSource- Returns:
- true iff this row source expects some row location to be returned
- See Also:
-
needsRowLocationForDeferredCheckConstraints
public boolean needsRowLocationForDeferredCheckConstraints()- Specified by:
needsRowLocationForDeferredCheckConstraintsin interfaceRowLocationRetRowSource
-
needsToClone
public boolean needsToClone()Description copied from interface:RowSourceDoes the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row. This call must always return the same for all rows in a RowSource (ie. the caller will call this once per scan from a RowSource and assume the behavior is true for all rows in the RowSource).- Specified by:
needsToClonein interfaceRowSource- See Also:
-
rowLocation
Description copied from interface:RowLocationRetRowSourcerowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource. This interface is for the purpose of loading a base table with index. In that case, the indices can be built at the same time the base table is laid down once the row location of the base row is known. This is an example pseudo code on how this call is expected to be used:boolean needsRL = rowSource.needsRowLocation(); DataValueDescriptor[] row; while((row = rowSource.getNextRowFromRowSource()) != null) { RowLocation rl = heapConglomerate.insertRow(row); if (needsRL) rowSource.rowLocation(rl); }
NeedsRowLocation and rowLocation will ONLY be called by a drainer of the row source which CAN return a row location. Drainer of row source which cannot return rowLocation will guarantee to not call either callbacks. Conversely, if NeedsRowLocation is called and it returns true, then for every row return by getNextRowFromRowSource, a rowLocation callback must also be issued with the row location of the row. Implementor of both the source and the drain of the row source must be aware of this protocol.
The RowLocation object is own by the caller of rowLocation, in other words, the drainer of the RowSource. This is so that we don't need to new a row location for every row. If the Row Source wants to keep the row location, it needs to clone it (RowLocation is a ClonableObject).- Specified by:
rowLocationin interfaceRowLocationRetRowSource- See Also:
-
offendingRowLocation
- Specified by:
offendingRowLocationin interfaceRowLocationRetRowSource- Throws:
StandardException
-
getValidColumns
All columns are always set from a sorter- Specified by:
getValidColumnsin interfaceRowSource
-
closeRowSource
public void closeRowSource()Close the row source - implemented by MergeScan already- Specified by:
closeRowSourcein interfaceRowSource
-