summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-05-09 03:36:30 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-05-09 03:36:30 +0000
commit3fad738c13c12f0be3cf4e453b559427e7f420d9 (patch)
tree6ac2f4befe3a1bfc2228e28ab9071e0732a11b0d /src/main/java/com/amazon/carbonado
parent57023295c1af81b4e4fd3dfd2d5969263179f54c (diff)
Clustered index selection fixes.
Diffstat (limited to 'src/main/java/com/amazon/carbonado')
-rw-r--r--src/main/java/com/amazon/carbonado/info/StorableIndex.java1
-rw-r--r--src/main/java/com/amazon/carbonado/qe/IndexedQueryExecutor.java2
-rw-r--r--src/main/java/com/amazon/carbonado/qe/OrderingScore.java6
-rw-r--r--src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java7
4 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/com/amazon/carbonado/info/StorableIndex.java b/src/main/java/com/amazon/carbonado/info/StorableIndex.java
index 9806c61..387e9cf 100644
--- a/src/main/java/com/amazon/carbonado/info/StorableIndex.java
+++ b/src/main/java/com/amazon/carbonado/info/StorableIndex.java
@@ -603,6 +603,7 @@ public class StorableIndex<S extends Storable> implements Appender {
if (obj instanceof StorableIndex) {
StorableIndex<?> other = (StorableIndex<?>) obj;
return isUnique() == other.isUnique()
+ && isClustered() == other.isClustered()
&& Arrays.equals(mProperties, other.mProperties)
&& Arrays.equals(mDirections, other.mDirections);
}
diff --git a/src/main/java/com/amazon/carbonado/qe/IndexedQueryExecutor.java b/src/main/java/com/amazon/carbonado/qe/IndexedQueryExecutor.java
index 0599b00..8954ed6 100644
--- a/src/main/java/com/amazon/carbonado/qe/IndexedQueryExecutor.java
+++ b/src/main/java/com/amazon/carbonado/qe/IndexedQueryExecutor.java
@@ -310,7 +310,7 @@ public class IndexedQueryExecutor<S extends Storable> extends AbstractQueryExecu
indent(app, indentLevel);
app.append("...covering filter: ");
mCoveringFilter.appendTo(app, values);
-
+ newline(app);
}
return true;
}
diff --git a/src/main/java/com/amazon/carbonado/qe/OrderingScore.java b/src/main/java/com/amazon/carbonado/qe/OrderingScore.java
index 9bfcde1..32f6936 100644
--- a/src/main/java/com/amazon/carbonado/qe/OrderingScore.java
+++ b/src/main/java/com/amazon/carbonado/qe/OrderingScore.java
@@ -526,7 +526,11 @@ public class OrderingScore<S extends Storable> {
// Choose index with any handled properties over the one with
// neither handled nor remainder properties.
if (Double.isNaN(firstRatio)) {
- if (!Double.isNaN(otherRatio)) {
+ if (Double.isNaN(otherRatio)) {
+ // Order checks are not really applicable. The query does
+ // not have an ordering applied to it.
+ return 0;
+ } else {
return 1;
}
} else if (Double.isNaN(otherRatio)) {
diff --git a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java
index 6409da7..9ff204f 100644
--- a/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java
+++ b/src/main/java/com/amazon/carbonado/repo/indexed/IndexedStorage.java
@@ -99,6 +99,9 @@ class IndexedStorage<S extends Storable> implements Storage<S>, StorageAccess<S>
{
desiredIndexSet = IndexAnalysis.gatherDesiredIndexes(info);
desiredIndexSet.reduce(Direction.ASCENDING);
+ if (mRepository.isAllClustered()) {
+ desiredIndexSet.markClustered(true);
+ }
}
// The set of indexes that are populated and available for use. This is
@@ -225,10 +228,6 @@ class IndexedStorage<S extends Storable> implements Storage<S>, StorageAccess<S>
// Add the indexes we get for free.
queryableIndexSet.addAll(freeIndexSet);
-
- if (mRepository.isAllClustered()) {
- queryableIndexSet.markClustered(true);
- }
}
// The set of indexes that should be kept up-to-date. If index repair