summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/amazon/carbonado/qe/JoinedQueryExecutor.java12
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