Repository: ignite Updated Branches: refs/heads/master 735ce60da -> 66a7eb3c6
master - test adjusted Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/66a7eb3c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/66a7eb3c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/66a7eb3c Branch: refs/heads/master Commit: 66a7eb3c6bd77d4af1a04f2224feac5c1a7e9fcb Parents: 735ce60 Author: Sergi Vladykin <sergi.vlady...@gmail.com> Authored: Tue Apr 18 17:21:20 2017 +0300 Committer: Sergi Vladykin <sergi.vlady...@gmail.com> Committed: Tue Apr 18 17:21:20 2017 +0300 ---------------------------------------------------------------------- ...teCacheJoinPartitionedAndReplicatedTest.java | 57 +++++++++++++++----- 1 file changed, 45 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/66a7eb3c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java index d4772c1..46b8272 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java @@ -39,6 +39,7 @@ import java.util.List; import java.util.concurrent.Callable; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; +import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -90,6 +91,8 @@ public class IgniteCacheJoinPartitionedAndReplicatedTest extends GridCommonAbstr { CacheConfiguration ccfg = configuration(ORG_CACHE); + ccfg.setCacheMode(PARTITIONED); + QueryEntity entity = new QueryEntity(); entity.setKeyType(Integer.class.getName()); entity.setValueType(Organization.class.getName()); @@ -157,6 +160,21 @@ public class IgniteCacheJoinPartitionedAndReplicatedTest extends GridCommonAbstr super.afterTestsStopped(); } + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + super.beforeTest(); + + Ignite client = grid(2); + + IgniteCache<Object, Object> personCache = client.cache(PERSON_CACHE); + IgniteCache<Object, Object> orgCache = client.cache(ORG_CACHE); + IgniteCache<Object, Object> orgCacheRepl = client.cache(ORG_CACHE_REPLICATED); + + personCache.clear(); + orgCache.clear(); + orgCacheRepl.clear(); + } + /** * @throws Exception If failed. */ @@ -207,24 +225,39 @@ public class IgniteCacheJoinPartitionedAndReplicatedTest extends GridCommonAbstr checkQuery("select o.name, p._key, p.name " + "from \"orgRepl\".Organization o left join \"person\".Person p " + "on (p.orgId = o.id)", orgCacheRepl, 2); + } - // Left join from replicated to partitioned cache is not supported: - // returns duplicates in result and must fail. - checkQueryFails("select o.name, p._key, p.name " + + /** + */ + public void testReplicatedToPartitionedLeftJoin() { + Ignite client = grid(2); + + IgniteCache<Object, Object> personCache = client.cache(PERSON_CACHE); + IgniteCache<Object, Object> orgCache = client.cache(ORG_CACHE); + IgniteCache<Object, Object> orgCacheRepl = client.cache(ORG_CACHE_REPLICATED); + + List<Integer> keys = primaryKeys(ignite(0).cache(PERSON_CACHE), 3, 200_000); + + orgCache.put(keys.get(0), new Organization(0, "org1")); + orgCacheRepl.put(keys.get(0), new Organization(0, "org1")); + personCache.put(keys.get(1), new Person(0, "p1")); + personCache.put(keys.get(2), new Person(0, "p2")); + + checkQuery("select o.name, p._key, p.name " + "from \"person\".Person p left join \"org\".Organization o " + - "on (p.orgId = o.id)", orgCache); + "on (p.orgId = o.id)", orgCache, 2); - checkQueryFails("select o.name, p._key, p.name " + + checkQuery("select o.name, p._key, p.name " + "from \"org\".Organization o right join \"person\".Person p " + - "on (p.orgId = o.id)", orgCache); + "on (p.orgId = o.id)", orgCache, 2); - checkQueryFails("select o.name, p._key, p.name " + - "from \"person\".Person p left join \"org\".Organization o " + - "on (p.orgId = o.id)", personCache); + checkQuery("select o.name, p._key, p.name " + + "from \"person\".Person p left join \"org\".Organization o " + + "on (p.orgId = o.id)", personCache, 2); - checkQueryFails("select o.name, p._key, p.name " + - "from \"org\".Organization o right join \"person\".Person p " + - "on (p.orgId = o.id)", personCache); + checkQuery("select o.name, p._key, p.name " + + "from \"org\".Organization o right join \"person\".Person p " + + "on (p.orgId = o.id)", personCache, 2); } /**