#ignite-758: remove unused methods from CacheQueries.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2006b66f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2006b66f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2006b66f Branch: refs/heads/ignite-737 Commit: 2006b66fa8a2ac8aaea7f96b6c9947858101f3b8 Parents: 17a8b09 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Thu Apr 16 18:10:19 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Thu Apr 16 18:10:19 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/query/CacheQueries.java | 16 ----- .../cache/query/CacheQueriesImpl.java | 11 ---- .../cache/GridCacheCrossCacheQuerySelfTest.java | 69 +++++++++++--------- 3 files changed, 39 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2006b66f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java index f5a31ef..54965dd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache.query; -import org.apache.ignite.cache.query.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; @@ -69,19 +68,4 @@ public interface CacheQueries<K, V> { * @return Query. */ public <R> CacheQuery<R> createSpiQuery(); - - /** - * @param space Space name. - * @param qry Query. - * @return Cursor. - */ - public QueryCursor<List<?>> execute(String space, GridCacheTwoStepQuery qry); - - /** - * @param space Space. - * @param sqlQry Query. - * @param params Parameters. - * @return Cursor. - */ - public QueryCursor<List<?>> executeTwoStepQuery(String space, String sqlQry, Object... params); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2006b66f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java index 7e66afa..5e3b11f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueriesImpl.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache.query; -import org.apache.ignite.cache.query.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; @@ -104,16 +103,6 @@ public class CacheQueriesImpl<K, V> implements CacheQueries<K, V> { } /** {@inheritDoc} */ - @Override public QueryCursor<List<?>> execute(String space, GridCacheTwoStepQuery qry) { - return ctx.kernalContext().query().queryTwoStep(space, qry); - } - - /** {@inheritDoc} */ - @Override public QueryCursor<List<?>> executeTwoStepQuery(String space, String sqlQry, Object[] params) { - return ctx.kernalContext().query().queryTwoStep(ctx, new SqlFieldsQuery(sqlQry).setArgs(params)); - } - - /** {@inheritDoc} */ @Override public CacheQuery<List<?>> createSqlFieldsQuery(String qry, boolean incMeta) { assert qry != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2006b66f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java index e870531..12a4af9 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java @@ -24,6 +24,7 @@ import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.query.*; +import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.spi.discovery.tcp.*; @@ -117,8 +118,7 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { public void _testTwoStep() throws Exception { String cache = "partitioned"; - CacheQueries<Integer, FactPurchase> qx = - ((IgniteKernal)ignite).<Integer, FactPurchase>getCache(cache).queries(); + GridQueryProcessor qryProc = ((IgniteKernal) ignite).context().query(); // for (Map.Entry<Integer, FactPurchase> e : qx.createSqlQuery(FactPurchase.class, "1 = 1").execute().get()) // X.println("___ " + e); @@ -127,7 +127,7 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { q.addMapQuery("_cnts_", "select count(*) x from \"partitioned\".FactPurchase where ? = ?", 2, 2); - Object cnt = qx.execute(cache, q).getAll().iterator().next().get(0); + Object cnt = qryProc.queryTwoStep(cache, q).getAll().iterator().next().get(0); assertEquals(10L, cnt); } @@ -136,15 +136,19 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testTwoStepGroupAndAggregates() throws Exception { - CacheQueries<Integer, FactPurchase> qx = - ((IgniteKernal)ignite).<Integer, FactPurchase>getCache("partitioned").queries(); + IgniteInternalCache<Integer, FactPurchase> cache = + ((IgniteKernal)ignite).getCache("partitioned"); + + GridQueryProcessor qryProc = ((IgniteKernal) ignite).context().query(); Set<Integer> set1 = new HashSet<>(); X.println("___ simple"); - for (List<?> o : qx.executeTwoStepQuery("partitioned", "select f.productId, p.name, f.price " + - "from FactPurchase f, \"replicated\".DimProduct p where p.id = f.productId ").getAll()) { + SqlFieldsQuery qry = new SqlFieldsQuery("select f.productId, p.name, f.price " + + "from FactPurchase f, \"replicated\".DimProduct p where p.id = f.productId "); + + for (List<?> o : qryProc.queryTwoStep(cache.context(), qry).getAll()) { X.println("___ -> " + o); set1.add((Integer)o.get(0)); @@ -156,8 +160,9 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { X.println("___ GROUP BY"); - for (List<?> o : qx.executeTwoStepQuery("partitioned", "select productId from FactPurchase group by productId") - .getAll()) { + qry = new SqlFieldsQuery("select productId from FactPurchase group by productId"); + + for (List<?> o : qryProc.queryTwoStep(cache.context(), qry).getAll()) { X.println("___ -> " + o); assertTrue(set0.add((Integer) o.get(0))); @@ -169,12 +174,13 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { Set<String> names = new HashSet<>(); - for (List<?> o : qx.executeTwoStepQuery("partitioned", - "select p.name, avg(f.price), min(f.price), max(f.price), sum(f.price), count(*), " + - "count(nullif(f.price, 5)) " + - "from FactPurchase f, \"replicated\".DimProduct p " + - "where p.id = f.productId " + - "group by f.productId, p.name").getAll()) { + qry = new SqlFieldsQuery("select p.name, avg(f.price), min(f.price), max(f.price), sum(f.price), count(*), " + + "count(nullif(f.price, 5)) " + + "from FactPurchase f, \"replicated\".DimProduct p " + + "where p.id = f.productId " + + "group by f.productId, p.name"); + + for (List<?> o : qryProc.queryTwoStep(cache.context(), qry).getAll()) { X.println("___ -> " + o); assertTrue(names.add((String)o.get(0))); @@ -183,12 +189,13 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { X.println("___ SUM HAVING"); - for (List<?> o : qx.executeTwoStepQuery("partitioned", - "select p.name, sum(f.price) s " + - "from FactPurchase f, \"replicated\".DimProduct p " + - "where p.id = f.productId " + - "group by f.productId, p.name " + - "having s >= 15").getAll()) { + qry = new SqlFieldsQuery("select p.name, sum(f.price) s " + + "from FactPurchase f, \"replicated\".DimProduct p " + + "where p.id = f.productId " + + "group by f.productId, p.name " + + "having s >= 15"); + + for (List<?> o : qryProc.queryTwoStep(cache.context(), qry).getAll()) { X.println("___ -> " + o); assertTrue(i(o, 1) >= 15); @@ -198,10 +205,11 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { int top = 6; - for (List<?> o : qx.executeTwoStepQuery("partitioned", - "select top 3 distinct productId " + - "from FactPurchase f " + - "order by productId desc ").getAll()) { + qry = new SqlFieldsQuery("select top 3 distinct productId " + + "from FactPurchase f " + + "order by productId desc "); + + for (List<?> o : qryProc.queryTwoStep(cache.context(), qry).getAll()) { X.println("___ -> " + o); assertEquals(top--, o.get(0)); @@ -211,11 +219,12 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { top = 5; - for (List<?> o : qx.executeTwoStepQuery("partitioned", - "select distinct productId " + - "from FactPurchase f " + - "order by productId desc " + - "limit 2 offset 1").getAll()) { + qry = new SqlFieldsQuery("select distinct productId " + + "from FactPurchase f " + + "order by productId desc " + + "limit 2 offset 1"); + + for (List<?> o : qryProc.queryTwoStep(cache.context(), qry).getAll()) { X.println("___ -> " + o); assertEquals(top--, o.get(0));