Repository: incubator-geode
Updated Branches:
  refs/heads/develop 1246f4fae -> 72e9cbe4e


GEODE-1840: Does not combine OR predicates into AND junctions


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

Branch: refs/heads/develop
Commit: 72e9cbe4e28d20b87befe3ba700d0f54040e4c69
Parents: 1246f4f
Author: Jason Huynh <huyn...@gmail.com>
Authored: Fri Sep 2 09:26:35 2016 -0700
Committer: Jason Huynh <huyn...@gmail.com>
Committed: Mon Sep 12 15:59:01 2016 -0700

----------------------------------------------------------------------
 .../internal/AbstractGroupOrRangeJunction.java  |  2 +-
 .../dunit/CompactRangeIndexQueryDUnitTest.java  | 43 +++++++++++++-------
 2 files changed, 29 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/72e9cbe4/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/AbstractGroupOrRangeJunction.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/AbstractGroupOrRangeJunction.java
 
b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/AbstractGroupOrRangeJunction.java
index a14dda8..cbe7e24 100644
--- 
a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/AbstractGroupOrRangeJunction.java
+++ 
b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/AbstractGroupOrRangeJunction.java
@@ -193,7 +193,7 @@ public abstract class AbstractGroupOrRangeJunction extends
           }
         }
         else {
-          if (newOperands.iterateOperand instanceof CompiledJunction) {
+          if (newOperands.iterateOperand instanceof CompiledJunction && 
((CompiledJunction) newOperands.iterateOperand).getOperator() == getOperator()) 
{
             CompiledJunction temp = 
(CompiledJunction)newOperands.iterateOperand;
             List prevOps = temp.getOperands();
             unevaluatedFilterOps.addAll(prevOps);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/72e9cbe4/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexQueryDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexQueryDUnitTest.java
 
b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexQueryDUnitTest.java
index 8b27309..12f36a1 100644
--- 
a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexQueryDUnitTest.java
+++ 
b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexQueryDUnitTest.java
@@ -16,39 +16,27 @@
  */
 package com.gemstone.gemfire.cache.query.dunit;
 
-import static 
com.gemstone.gemfire.internal.cache.execute.DistributedRegionFunctionExecutionDUnitTest.region;
-import static java.rmi.activation.ActivationGroup.getSystem;
 import static org.junit.Assert.*;
 
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.query.Query;
 import com.gemstone.gemfire.cache.query.QueryService;
-import com.gemstone.gemfire.cache.query.QueryTestUtils;
 import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.cache.query.data.Portfolio;
 import com.gemstone.gemfire.cache.query.data.PortfolioPdx;
-import com.gemstone.gemfire.cache.query.internal.ResultsSet;
-import com.gemstone.gemfire.cache.query.internal.index.IndexManager;
-import com.gemstone.gemfire.cache.query.internal.index.IndexManager.TestHook;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
@@ -88,4 +76,29 @@ public class CompactRangeIndexQueryDUnitTest extends 
JUnit4CacheTestCase {
     assertEquals( numMatching, rs.size());
   }
 
+  @Test
+  public void 
whenAuxFilterWithAnIterableFilterShouldNotCombineFiltersIntoAndJunction() 
throws Exception {
+    Cache cache = getCache();
+    Region region = 
cache.createRegionFactory(RegionShortcut.PARTITION).create("ExampleRegion");
+    QueryService qs = cache.getQueryService();
+    qs.createIndex("ExampleRegionIndex", "er['codeNumber','origin']", 
"/ExampleRegion er");
+
+    for (int i = 0; i < 10; i++) {
+      Map<String, Object> data = new HashMap<String, Object>();
+      data.put("codeNumber", 1);
+      if ((i % 3) == 0) {
+        data.put("origin", "src_common");
+      } else {
+        data.put("origin", "src_" + i);
+      }
+      data.put("attr", "attrValue");
+      data.put("country", "JPY");
+
+      region.put(String.valueOf(i), data);
+    }
+
+    Query q = qs.newQuery("select * from /ExampleRegion E where 
E['codeNumber']=1 and E['origin']='src_common' and (E['country']='JPY' or 
E['ccountrycy']='USD')");
+    SelectResults rs = (SelectResults) q.execute();
+    assertEquals( 4, rs.size());
+  }
 }

Reply via email to