summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-01-19 00:42:05 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-01-19 00:42:05 +0000
commitdf986362a47fa9c3e9243e5c5de2153889d2f103 (patch)
tree74e7544cd3970f896f70a1d1cb5f998fd8e204e4 /src/main/java/com/amazon/carbonado
parent723cbaf65030ce7bb78a3586ceb3bccd622673aa (diff)
Added additional index selection tie-breaker if index is most likely defined to support desired ordering.
Diffstat (limited to 'src/main/java/com/amazon/carbonado')
-rw-r--r--src/main/java/com/amazon/carbonado/qe/CompositeScore.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/com/amazon/carbonado/qe/CompositeScore.java b/src/main/java/com/amazon/carbonado/qe/CompositeScore.java
index 9992690..e031fe2 100644
--- a/src/main/java/com/amazon/carbonado/qe/CompositeScore.java
+++ b/src/main/java/com/amazon/carbonado/qe/CompositeScore.java
@@ -224,8 +224,18 @@ public class CompositeScore<S extends Storable> {
return preferenceResult;
}
- // Preference scores are the same? That seems unlikely, but
- // choose the better filtering index.
+ // Okay, preference is not helping. If handled filter count is
+ // the same, choose the better ordering. Why? Most likely a nearly
+ // identical index was created specifically for ordering. One index
+ // might look better for filtering just because it is clustered.
+
+ if (firstScore.getHandledCount() == secondScore.getHandledCount()) {
+ if (handledScore != 0) {
+ return handledScore;
+ }
+ }
+
+ // Just return the result for the better filtering index.
return result;
}