geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [10/33] geode git commit: GEODE-2961: Fixed distinct multiple OR query returning partial results
Date Tue, 23 May 2017 22:39:15 GMT
GEODE-2961: Fixed distinct multiple OR query returning partial results


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/456ee157
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/456ee157
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/456ee157

Branch: refs/heads/feature/GEODE-2632-17
Commit: 456ee15768fb08c8e1c8c5836479d27e1bc61835
Parents: 9c40868
Author: David Anuta <david.r.anuta@gmail.com>
Authored: Tue May 23 13:53:19 2017 -0700
Committer: nabarun <nnag@pivotal.io>
Committed: Tue May 23 14:05:41 2017 -0700

----------------------------------------------------------------------
 .../internal/AbstractGroupOrRangeJunction.java      |  2 +-
 .../query/internal/index/IndexUseJUnitTest.java     | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/456ee157/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractGroupOrRangeJunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractGroupOrRangeJunction.java
b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractGroupOrRangeJunction.java
index 5ed4d86..35f0290 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractGroupOrRangeJunction.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AbstractGroupOrRangeJunction.java
@@ -325,7 +325,7 @@ public abstract class AbstractGroupOrRangeJunction extends AbstractCompiledValue
         if (intermediateResults == null) {
           intermediateResults = filterResults;
         } else if (isDistinct && !isConditioningNeeded) {
-          intermediateResults = filterResults;
+          intermediateResults.addAll(filterResults);
         } else {
           intermediateResults = QueryUtils.union(intermediateResults, filterResults, context);
         }

http://git-wip-us.apache.org/repos/asf/geode/blob/456ee157/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexUseJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexUseJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexUseJUnitTest.java
index c55f3f3..9c8756c 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexUseJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexUseJUnitTest.java
@@ -1366,6 +1366,22 @@ public class IndexUseJUnitTest {
   }
 
   @Test
+  public void queryWithOrClauseShouldReturnCorrectResultSet() throws Exception {
+    String query =
+        "SELECT DISTINCT p1.ID FROM /pos p1 where p1.ID IN SET (0,1) OR p1.status = 'active'";
+
+    Query q = qs.newQuery(query);
+    QueryObserverImpl observer = new QueryObserverImpl();
+    QueryObserverHolder.setInstance(observer);
+    SelectResults sr = (SelectResults) q.execute();
+    if (!observer.isIndexesUsed)
+      fail("Index should have been used for query '" + q.getQueryString() + "'");
+
+    assertEquals(sr.size(), 3);
+    qs.removeIndexes();
+  }
+
+  @Test
   public void testIndexUseSelfJoin() throws Exception {
     String[] queries = {"SELECT DISTINCT * FROM /pos p1, /pos p2 where p1.status = p1.status",
         "SELECT DISTINCT * FROM /pos p1, /pos p2 where p1.ID = p2.ID",


Mime
View raw message