| Modifier and Type | Field and Description |
|---|---|
| protected DataValueDescriptor[] | origProbeValues
The values with which we will probe the table, as they were passed to the constructor. |
| protected int | probeValIndex
0-based position of the next value to lookup w.r.t. the probe values list. |
| protected DataValueDescriptor[] | probeValues
The values with which we will probe the table. |
| private boolean | skipNextScan
Tells whether or not we should skip the next attempt to (re)open the scan controller. |
| private int | sortRequired
Indicator as to which type of sort we need: ASCENDING, DESCENDING, or NONE (NONE is represented by "RowOrdering.DONTCARE" and is used for cases where all necessary sorting occurred at compilation time). |
| Access | Constructor and Description |
|---|---|
| pack-priv | MultiProbeTableScanResultSet(long conglomId, StaticCompiledOpenConglomInfo scoci, Activation activation, int resultRowTemplate, int resultSetNumber, GeneratedMethod startKeyGetter, int startSearchOperator, GeneratedMethod stopKeyGetter, int stopSearchOperator, boolean sameStartStopPosition, Qualifier[][] qualifiers, DataValueDescriptor[] probingVals, int sortRequired, String tableName, String userSuppliedOptimizerOverrides, String indexName, boolean isConstraint, boolean forUpdate, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, boolean oneRowScan, double optimizerEstimatedRowCount, double optimizerEstimatedCost)
Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides org. Implements org. Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet. |
| private DataValueDescriptor | |
| public ExecRow | getNextRowCore()
Overrides org. Implements org. Return the next row (if any) from the scan (if open). |
| pack-priv void | initStartAndStopKey()
Overrides org. Initialize the start key and the stop key used in the scan. |
| private boolean | moreInListVals()
Figure out whether or not we can (re-)position the scan controller based on the next value in probeValues. |
| public void | openCore()
Overrides org. Implements org. open a scan on the table. |
| public void | reopenCore()
Overrides org. Implements org. Reopen a table scan. |
| private void | reopenCore(boolean forNextProbe)
There are two scenarios for which we reopen this kind of scan: A - The first is for join processing. |
| protected void | reopenScanController()
Overrides org. Reopen the scan controller |
| protected boolean | Returns: true if scan should be skipped, false otherwisethe key on which to start the scan startPosition, ExecIndexRow the key on which to stop the scan stopPosition)Overrides org. Check if the scan should be skipped. |
| origProbeValues | back to summary |
|---|---|
| protected DataValueDescriptor[] origProbeValues The values with which we will probe the table, as they were passed to the constructor. We need to keep them unchanged in case the result set is reused when a statement is re-executed (see DERBY-827). | |
| probeValIndex | back to summary |
|---|---|
| protected int probeValIndex 0-based position of the next value to lookup w.r.t. the probe values list. | |
| probeValues | back to summary |
|---|---|
| protected DataValueDescriptor[] probeValues The values with which we will probe the table. | |
| skipNextScan | back to summary |
|---|---|
| private boolean skipNextScan Tells whether or not we should skip the next attempt to (re)open the
scan controller. If it is | |
| sortRequired | back to summary |
|---|---|
| private int sortRequired Indicator as to which type of sort we need: ASCENDING, DESCENDING, or NONE (NONE is represented by "RowOrdering.DONTCARE" and is used for cases where all necessary sorting occurred at compilation time). | |
| MultiProbeTableScanResultSet | back to summary |
|---|---|
| pack-priv MultiProbeTableScanResultSet(long conglomId, StaticCompiledOpenConglomInfo scoci, Activation activation, int resultRowTemplate, int resultSetNumber, GeneratedMethod startKeyGetter, int startSearchOperator, GeneratedMethod stopKeyGetter, int stopSearchOperator, boolean sameStartStopPosition, Qualifier[][] qualifiers, DataValueDescriptor[] probingVals, int sortRequired, String tableName, String userSuppliedOptimizerOverrides, String indexName, boolean isConstraint, boolean forUpdate, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, boolean oneRowScan, double optimizerEstimatedRowCount, double optimizerEstimatedCost) throws StandardException Constructor. Just save off the relevant probing state and pass everything else up to TableScanResultSet.
| |
| close | back to summary |
|---|---|
| public void close() throws StandardException Overrides org. Implements org. Doc from org. Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.
| |
| getNextProbeValue | back to summary |
|---|---|
| private DataValueDescriptor getNextProbeValue() Return the next non-duplicate value from the probe list. Assumption is that the list is sorted so that duplicates appear next to each other, and that probeValIndex is the index of the next value. If we've exhausted the probe list then just return null. | |
| getNextRowCore | back to summary |
|---|---|
| public ExecRow getNextRowCore() throws StandardException Overrides org. Implements org. Return the next row (if any) from the scan (if open). More specifically we do the following: 1 - See if we have a row to read from the current scan position. If so, return that row (done). 2 - If there are no more rows to read from the current scan position AND if there are more probe values to look at, then a) reposition the scan using the next probe value as the start/stop key and b) go back to step 1. Otherwise proceed to step 3. 3 - Return null (no more rows). Note that step 1 is important for cases where multiple rows in this table match a single probe value. In such a scenario we have to be sure that we do *not* move on to the next probe value until we have returned all of the rows for the _current_ probe value.
| |
| initStartAndStopKey | back to summary |
|---|---|
| pack-priv void initStartAndStopKey() throws StandardException Overrides org. Initialize the start key and the stop key used in the scan. Both keys
will be set to the probe value. If no new probe value was found (the
probe list was exhausted), the flag skipNextScan will be | |
| moreInListVals | back to summary |
|---|---|
| private boolean moreInListVals() Figure out whether or not we can (re-)position the scan controller based on the next value in probeValues. This will return false when we have exhausted the probe list (i.e. when we've gone through all of the values). | |
| openCore | back to summary |
|---|---|
| public void openCore() throws StandardException Overrides org. Implements org. Doc from org. open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...
| |
| reopenCore | back to summary |
|---|---|
| public void reopenCore() throws StandardException Overrides org. Implements org. Doc from org. Reopen a table scan. Here we take advantage of the reopenScan() interface on scanController for optimimal performance on joins where we are an inner table.
| |
| reopenCore | back to summary |
|---|---|
| private void reopenCore(boolean forNextProbe) throws StandardException There are two scenarios for which we reopen this kind of scan: A - The first is for join processing. In this case we have a(nother) row from some outer table and we want to reopen this scan to look for rows matching the new outer row. B - The second is for multi-probing. Here we want to reopen the scan on this table to look for rows matching the next value in the probe list. If we are reopening the scan for scenario A (join processing) then we need to reset our position within the probe list. If we are reopening the scan for scenario B then we do *not* want to reset our position within the probe list because that position tells us where to find the next probe value. That said, this method does the work of reopenCore() using the received boolean to determine which of the two scenarios we are in. Note that if our current position (i.e. the value of probeValIndex) is beyond the length of the probe list then we know that we are reopening the scan for scenario A. Or put another away, we should never get here for scenario B if probeValIndex is greater than or equal to the length of the probe list. The reason is that the call to reopenCore() for scenario B will only ever happen when moreInListVals() returns true--and in that case we know that probeValIndex will be less than the length of the probeValues. But the opposite is not true: i.e. it is *not* safe to say that a probeValIndex which is less than the length of probe list is always for scenario B. That's not true because it's possible that the join to which this scan belongs is a "oneRowRightSide" join, meaning that this, the "right" side scan, will be "interrupted" after we return a single row for the current outer row. If we then come back with a new outer row we need to reset our position-- even though probeValIndex will be less than probeValues.length in that case. DERBY-3603. | |
| reopenScanController | back to summary |
|---|---|
| protected void reopenScanController() throws StandardException Overrides org. Reopen the scan controller
| |
| skipScan | back to summary |
|---|---|
| protected boolean skipScan(ExecIndexRow startPosition, ExecIndexRow stopPosition) throws StandardException Overrides org. Check if the scan should be skipped. It should be skipped if (1)
| |