diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2009-06-12 23:48:38 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2009-06-12 23:48:38 +0000 |
commit | 16076fc8e7f4922e924eee0f1c14bc8b86a89bb9 (patch) | |
tree | 94b0460b1fa1bbec57769894e41b1276041a1e71 /src/main/java/com | |
parent | 1cb409d648a50dbb41de319d6ff7bf1eccff1d5a (diff) |
Add extra check before applying join sort optimization.
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/amazon/carbonado/qe/JoinedQueryExecutor.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/qe/JoinedQueryExecutor.java b/src/main/java/com/amazon/carbonado/qe/JoinedQueryExecutor.java index 5c11157..fa1d38e 100644 --- a/src/main/java/com/amazon/carbonado/qe/JoinedQueryExecutor.java +++ b/src/main/java/com/amazon/carbonado/qe/JoinedQueryExecutor.java @@ -530,10 +530,16 @@ public class JoinedQueryExecutor<S extends Storable, T extends Storable> mInnerLoopFilterValues = innerLoopExecutorFilter.initialFilterValues();
- // Only perform requested ordering if it index provides it for free.
+ // Only perform requested ordering if inner loop index provides it for
+ // free. This optimization is only valid if outer loop matches at most
+ // one record.
if (targetOrdering != null) {
- targetOrdering =
- expectedOrdering(targetAccess, innerLoopExecutorFilter, targetOrdering);
+ if (outerLoopExecutor instanceof KeyQueryExecutor) {
+ targetOrdering =
+ expectedOrdering(targetAccess, innerLoopExecutorFilter, targetOrdering);
+ } else {
+ targetOrdering = null;
+ }
}
mInnerLoopExecutor = innerLoopExecutorFactory
|