Class MergeScan
java.lang.Object
org.apache.derby.impl.store.access.sort.Scan
org.apache.derby.impl.store.access.sort.SortScan
org.apache.derby.impl.store.access.sort.MergeScan
- All Implemented Interfaces:
ScanManager, GenericScanController, GroupFetchScanController, RowCountable, ScanController, ScanInfo
- Direct Known Subclasses:
MergeScanRowSource
A sort scan that is capable of merging as many merge runs
as will fit in the passed-in sort buffer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe merge runs.protected StreamContainerHandle[]Array of scan controllers for the merge runs.protected SortBufferThe sort buffer we will use.private SortObserverFields inherited from interface ScanController
GE, GT, NA -
Constructor Summary
ConstructorsConstructorDescriptionMergeScan(MergeSort sort, TransactionManager tran, SortBuffer sortBuffer, Vector<Long> mergeRuns, SortObserver sortObserver, boolean hold) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the scan.booleancloseForEndTransaction(boolean closeHeldScan) Close the scan.booleaninit(TransactionManager tran) Initialize the scan, returning false if there was some error.(package private) voidmergeARow(int scanindex) Insert rows while we keep getting duplicates from the merge run whose scan is in the open scan array entry indexed by scanindex.booleannext()Move to the next position in the scan.Methods 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, setEstimatedRowCount
-
Field Details
-
sortBuffer
The sort buffer we will use. -
mergeRuns
-
openScans
Array of scan controllers for the merge runs. Entries in the array become null as the last row is pulled out and the scan is closed. -
sortObserver
-
-
Constructor Details
-
MergeScan
MergeScan(MergeSort sort, TransactionManager tran, SortBuffer sortBuffer, Vector<Long> mergeRuns, SortObserver sortObserver, boolean hold)
-
-
Method Details
-
next
Move to the next position in the scan.- Returns:
- True if there is a next position in the scan, false if there isn't.
- Throws:
StandardException- Standard exception policy.- See Also:
-
close
public void close()Close the scan.- Specified by:
closein interfaceGenericScanController- Overrides:
closein classSortScan- See Also:
-
closeForEndTransaction
public boolean closeForEndTransaction(boolean closeHeldScan) Close the scan.- Parameters:
closeHeldScan- If true, means to close scan even if it has been opened to be kept opened across commit. This is used to close these scans on abort.- Returns:
- boolean indicating that the close has resulted in a real close of the scan. A held scan will return false if called by closeForEndTransaction(false), otherwise it will return true. A non-held scan will always return true.
- See Also:
-
init
Initialize the scan, returning false if there was some error.- Throws:
StandardException
-
mergeARow
Insert rows while we keep getting duplicates from the merge run whose scan is in the open scan array entry indexed by scanindex.- Throws:
StandardException
-