summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/qe
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/amazon/carbonado/qe')
-rw-r--r--src/main/java/com/amazon/carbonado/qe/FullScanQueryExecutor.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/qe/FullScanQueryExecutor.java b/src/main/java/com/amazon/carbonado/qe/FullScanQueryExecutor.java
index dbf5690..b8035f0 100644
--- a/src/main/java/com/amazon/carbonado/qe/FullScanQueryExecutor.java
+++ b/src/main/java/com/amazon/carbonado/qe/FullScanQueryExecutor.java
@@ -51,6 +51,15 @@ public class FullScanQueryExecutor<S extends Storable> extends AbstractQueryExec
mSupport = support;
}
+ @Override
+ public long count(FilterValues<S> values) throws FetchException {
+ long count = mSupport.countAll();
+ if (count == -1) {
+ count = super.count(values);
+ }
+ return count;
+ }
+
/**
* Returns an open filter.
*/
@@ -83,6 +92,12 @@ public class FullScanQueryExecutor<S extends Storable> extends AbstractQueryExec
Class<S> getStorableType();
/**
+ * Counts all Storables. Implementation may return -1 to indicate that
+ * default count algorithm should be used.
+ */
+ long countAll() throws FetchException;
+
+ /**
* Perform a full scan of all Storables.
*/
Cursor<S> fetchAll() throws FetchException;