| Modifier and Type | Field and Description |
|---|---|
| protected boolean | alreadyInOrder
Whether the rows are expected to be in order on insert, as passed in on create. |
| protected ColumnOrdering[] | columnOrdering
The column ordering as passed in on create. |
| protected boolean[] | columnOrderingAscendingMap
A lookup table to speed up lookup of Ascending state of a column, |
| protected int[] | columnOrderingMap
A lookup table to speed up lookup of a column associated with the i'th column to compare. |
| protected boolean[] | columnOrderingNullsLowMap
A lookup table to speed up lookup of nulls-low ordering of a column, |
| private MergeInserter | inserter
The inserter that's being used to insert rows into the sort. |
| private Vector | mergeRuns
A vector of merge runs, produced by the MergeInserter. |
| pack-priv static Properties | properties
Properties for mergeSort |
| private Scan | scan
The scan that's being used to return rows from the sort. |
| private SortBuffer | sortBuffer
An ordered set of the leftover rows that didn't go in the last merge run (might be all the rows if there are no merge runs). |
| pack-priv int | sortBufferMax
The maximum number of entries a sort buffer can hold. |
| pack-priv int | sortBufferMin
The minimum number of entries a sort buffer can hold. |
| pack-priv SortObserver | sortObserver
The sort observer. |
| private int | state
Maintains the current state of the sort as defined in the preceding values. |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| protected DataValueDescriptor[] | template
The template as passed in on create. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | Returns: true if the ordering is valid, false if not.Check the column ordering against the template, making sure that each
column is present in the template, is not mentioned more than once, and
that the columns isn't |
| pack-priv void | checkColumnTypes(DataValueDescriptor[] row)
Check that the columns in the row agree with the columns in the template, both in number and in type. |
| protected int | |
| pack-priv long | createMergeRun(TransactionManager tran, SortBuffer sortBuffer)
Remove all the rows from the sort buffer and store them in a temporary conglomerate. |
| pack-priv void | doneInserting(MergeInserter inserter, SortBuffer sortBuffer, Vector<Long> mergeRuns)
An inserter is closing. |
| pack-priv void | |
| pack-priv void | |
| public void | drop(TransactionController tran)
Implements org. Drop the sort. |
| pack-priv void | |
| public void | initialize(DataValueDescriptor[] template, ColumnOrdering[] columnOrdering, SortObserver sortObserver, boolean alreadyInOrder, long estimatedRows, int sortBufferMax)
Go from the CLOSED to the INITIALIZED state. |
| private void | |
| public SortController | open(TransactionManager tran)
Implements org. Open a sort controller. |
| public ScanControllerRowSource | openSortRowSource(TransactionManager tran)
Implements org. Open a row source to get rows out of the sorter. |
| public ScanManager | openSortScan(TransactionManager tran, boolean hold)
Implements org. Open a scan controller. |
| alreadyInOrder | back to summary |
|---|---|
| protected boolean alreadyInOrder Whether the rows are expected to be in order on insert, as passed in on create. | |
| columnOrdering | back to summary |
|---|---|
| protected ColumnOrdering[] columnOrdering The column ordering as passed in on create. Valid when the state is INITIALIZED through SCANNING, null otherwise. May be null if there is no column ordering - this means that all rows are considered to be duplicates, and the sort will only emit a single row. | |
| columnOrderingAscendingMap | back to summary |
|---|---|
| protected boolean[] columnOrderingAscendingMap A lookup table to speed up lookup of Ascending state of a column, | |
| columnOrderingMap | back to summary |
|---|---|
| protected int[] columnOrderingMap A lookup table to speed up lookup of a column associated with the i'th column to compare. To find the column id to compare as the i'th column look in columnOrderingMap[i]. | |
| columnOrderingNullsLowMap | back to summary |
|---|---|
| protected boolean[] columnOrderingNullsLowMap A lookup table to speed up lookup of nulls-low ordering of a column, | |
| inserter | back to summary |
|---|---|
| private MergeInserter inserter The inserter that's being used to insert rows into the sort. This field is only valid when the state is INSERTING. | |
| mergeRuns | back to summary |
|---|---|
| private Vector<Long> mergeRuns A vector of merge runs, produced by the MergeInserter. Might be null if no merge runs were produced. It is a vector of container ids. | |
| properties | back to summary |
|---|---|
| pack-priv static Properties properties Properties for mergeSort | |
| scan | back to summary |
|---|---|
| private Scan scan The scan that's being used to return rows from the sort. This field is only valid when the state is SCANNING. | |
| sortBuffer | back to summary |
|---|---|
| private SortBuffer sortBuffer An ordered set of the leftover rows that didn't go in the last merge run (might be all the rows if there are no merge runs). | |
| sortBufferMax | back to summary |
|---|---|
| pack-priv int sortBufferMax The maximum number of entries a sort buffer can hold. | |
| sortBufferMin | back to summary |
|---|---|
| pack-priv int sortBufferMin The minimum number of entries a sort buffer can hold. | |
| sortObserver | back to summary |
|---|---|
| pack-priv SortObserver sortObserver The sort observer. May be null. Used as a callback. | |
| state | back to summary |
|---|---|
| private int state Maintains the current state of the sort as defined in the preceding values. Sorts start off and end up closed. | |
| STATE_CLOSED | back to summary |
|---|---|
| private static final int STATE_CLOSED | |
| STATE_DONE_INSERTING | back to summary |
|---|---|
| private static final int STATE_DONE_INSERTING | |
| STATE_DONE_SCANNING | back to summary |
|---|---|
| private static final int STATE_DONE_SCANNING | |
| STATE_INITIALIZED | back to summary |
|---|---|
| private static final int STATE_INITIALIZED | |
| STATE_INSERTING | back to summary |
|---|---|
| private static final int STATE_INSERTING | |
| STATE_SCANNING | back to summary |
|---|---|
| private static final int STATE_SCANNING | |
| template | back to summary |
|---|---|
| protected DataValueDescriptor[] template The template as passed in on create. Valid when the state is INITIALIZED through SCANNING, null otherwise. | |
| MergeSort | back to summary |
|---|---|
| pack-priv MergeSort() | |
| checkColumnOrdering | back to summary |
|---|---|
| private boolean checkColumnOrdering(DataValueDescriptor[] template, ColumnOrdering[] columnOrdering) Check the column ordering against the template, making sure that each
column is present in the template, is not mentioned more than once, and
that the columns isn't
Intended to be called as part of a sanity check. All columns are
orderable, since
| |
| checkColumnTypes | back to summary |
|---|---|
| pack-priv void checkColumnTypes(DataValueDescriptor[] row) throws StandardException Check that the columns in the row agree with the columns in the template, both in number and in type. XXX (nat) Currently checks that the classes implementing each column are the same -- is this right? | |
| compare | back to summary |
|---|---|
| protected int compare(DataValueDescriptor[] r1, DataValueDescriptor[] r2) throws StandardException | |
| createMergeRun | back to summary |
|---|---|
| pack-priv long createMergeRun(TransactionManager tran, SortBuffer sortBuffer) throws StandardException Remove all the rows from the sort buffer and store them in a temporary conglomerate. The temporary conglomerate is a "merge run". Returns the container id of the merge run. | |
| doneInserting | back to summary |
|---|---|
| pack-priv void doneInserting(MergeInserter inserter, SortBuffer sortBuffer, Vector<Long> mergeRuns) An inserter is closing. | |
| doneScanning | back to summary |
|---|---|
| pack-priv void doneScanning(Scan scan, SortBuffer sortBuffer) | |
| doneScanning | back to summary |
|---|---|
| pack-priv void doneScanning(Scan scan, SortBuffer sortBuffer, Vector<Long> mergeRuns) | |
| drop | back to summary |
|---|---|
| public void drop(TransactionController tran) throws StandardException Implements org. Drop the sort.
| |
| dropMergeRuns | back to summary |
|---|---|
| pack-priv void dropMergeRuns(TransactionManager tran) Get rid of the merge runs, if there are any. Must not cause any errors because it's called during error processing. | |
| initialize | back to summary |
|---|---|
| public void initialize(DataValueDescriptor[] template, ColumnOrdering[] columnOrdering, SortObserver sortObserver, boolean alreadyInOrder, long estimatedRows, int sortBufferMax) throws StandardException Go from the CLOSED to the INITIALIZED state. | |
| multiStageMerge | back to summary |
|---|---|
| private void multiStageMerge(TransactionManager tran) throws StandardException | |
| open | back to summary |
|---|---|
| public SortController open(TransactionManager tran) throws StandardException Implements org. Open a sort controller. This implementation only supports a single sort controller per sort.
| |
| openSortRowSource | back to summary |
|---|---|
| public ScanControllerRowSource openSortRowSource(TransactionManager tran) throws StandardException Implements org. Open a row source to get rows out of the sorter.
| |
| openSortScan | back to summary |
|---|---|
| public ScanManager openSortScan(TransactionManager tran, boolean hold) throws StandardException Implements org. Open a scan controller.
| |