summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/qe
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2006-09-07 01:12:04 +0000
committerBrian S. O'Neill <bronee@gmail.com>2006-09-07 01:12:04 +0000
commit8f791a3e9e36fac4345ebb75ba1d9fe51b4b1b55 (patch)
tree71895833e72e2f17240743e7b6fde0b3b25f6c57 /src/main/java/com/amazon/carbonado/qe
parent9c29c1190a6e70e5a1c200ca1ed1f403b7c56ead (diff)
Initial tests and fixes for union query analysis.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/qe')
-rw-r--r--src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java10
-rw-r--r--src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java10
2 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java b/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java
index 76fb5f5..d0bd63f 100644
--- a/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java
+++ b/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java
@@ -431,6 +431,16 @@ public class IndexedQueryAnalyzer<S extends Storable> {
return new Result(this, filter, getRemainderOrderings());
}
+ public String toString() {
+ return "IndexedQueryAnalyzer.Result {score="
+ + getCompositeScore() + ", localIndex="
+ + getLocalIndex() + ", foreignIndex="
+ + getForeignIndex() + ", foreignProperty="
+ + getForeignProperty() + ", remainderFilter="
+ + getRemainderFilter() + ", remainderOrderings="
+ + getRemainderOrderings() + '}';
+ }
+
private boolean equals(Object a, Object b) {
return a == null ? (b == null) : (a.equals(b));
}
diff --git a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java
index 9ed94fd..5648d21 100644
--- a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java
+++ b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java
@@ -77,9 +77,13 @@ public class UnionQueryAnalyzer<S extends Storable> {
throw new IllegalArgumentException("Filter must be bound");
}
+ if (orderings == null) {
+ orderings = Collections.emptyList();
+ }
+
List<IndexedQueryAnalyzer<S>.Result> subResults = splitIntoSubResults(filter, orderings);
- if (subResults.size() < 1) {
+ if (subResults.size() <= 1) {
// Total ordering not required.
return new Result(subResults);
}
@@ -112,7 +116,7 @@ public class UnionQueryAnalyzer<S extends Storable> {
// since one simple change might alter the query plan.
subResults = splitIntoSubResults(filter, orderings);
- if (subResults.size() < 1) {
+ if (subResults.size() <= 1) {
// Total ordering no longer required.
return new Result(subResults);
}
@@ -183,7 +187,7 @@ public class UnionQueryAnalyzer<S extends Storable> {
orderings.add(OrderedProperty.get(bestProperty, best.getBestDirection()));
subResults = splitIntoSubResults(filter, orderings);
- if (subResults.size() < 1) {
+ if (subResults.size() <= 1) {
// Total ordering no longer required.
break;
}