summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2006-09-06 15:06:46 +0000
committerBrian S. O'Neill <bronee@gmail.com>2006-09-06 15:06:46 +0000
commit9c29c1190a6e70e5a1c200ca1ed1f403b7c56ead (patch)
tree3d1e062b718fc1c4dc2dc4d7a2fb4b516c067c80 /src
parent7cd5f147ea63fbead8d53927d52e144ff0e2e1a5 (diff)
Short-circuit if re-calc eliminates needs for union.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java
index 2f467eb..9ed94fd 100644
--- a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java
+++ b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java
@@ -111,6 +111,11 @@ public class UnionQueryAnalyzer<S extends Storable> {
// Re-calc with specified direction. Only do one property at a time
// since one simple change might alter the query plan.
subResults = splitIntoSubResults(filter, orderings);
+
+ if (subResults.size() < 1) {
+ // Total ordering no longer required.
+ return new Result(subResults);
+ }
}
// Gather all the keys available. As ordering properties touch key
@@ -178,6 +183,11 @@ public class UnionQueryAnalyzer<S extends Storable> {
orderings.add(OrderedProperty.get(bestProperty, best.getBestDirection()));
subResults = splitIntoSubResults(filter, orderings);
+ if (subResults.size() < 1) {
+ // Total ordering no longer required.
+ break;
+ }
+
// Remove property from super key and key set...
superKey.remove(bestProperty);
if (superKey.size() == 0) {