From 9afe8abca1ae161905f1bcb179479a279580b6c8 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sat, 12 Jul 2008 06:10:18 +0000 Subject: Fix remainder append for full scan queries with 'or' expressions. --- src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java | 8 ++++++-- src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java b/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java index 875eda3..d7f30c8 100644 --- a/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java +++ b/src/main/java/com/amazon/carbonado/qe/IndexedQueryAnalyzer.java @@ -474,9 +474,13 @@ public class IndexedQueryAnalyzer { * Returns a new result with the remainder filter replaced. */ public Result withRemainderFilter(Filter remainderFilter) { + Filter handledFilter = getCompositeScore().getFilteringScore().getHandledFilter(); + + Filter filter = andFilters(handledFilter, remainderFilter); + CompositeScore score = mScore.withRemainderFilter(remainderFilter); - return new Result(mFilter, score, mLocalIndex, - mForeignIndex, mForeignProperty, mHints); + + return new Result(filter, score, mLocalIndex, mForeignIndex, mForeignProperty, mHints); } /** diff --git a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java index 6e5262f..17e84ad 100644 --- a/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java +++ b/src/main/java/com/amazon/carbonado/qe/UnionQueryAnalyzer.java @@ -426,7 +426,7 @@ public class UnionQueryAnalyzer implements QueryExecutorFact if (mergedResults.size() == 0) { // Nothing was exempt. Rather than return a result with a dnf // filter, return full scan with a simpler reduced filter. - full.withRemainderFilter(filter.reduce()); + full = full.withRemainderFilter(filter.reduce()); } mergedResults.add(full); -- cgit v1.2.3