Skip to content

Commit

Permalink
#ignite-738: rename GridCacheQueriesEx to CacheQueries.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Apr 14, 2015
1 parent 540299b commit 0920bcf
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 43 deletions.
Expand Up @@ -22,7 +22,7 @@
/**
* Cache query metrics used to obtain statistics on query. You can get metrics for
* particular query via {@link CacheQuery#metrics()} method or accumulated metrics
* for all queries via {@link GridCacheQueriesEx#metrics()}.
* for all queries via {@link CacheQueries#metrics()}.
*/
public interface QueryMetrics {
/**
Expand Down
Expand Up @@ -205,7 +205,7 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
* @return Queries facade responsible for creating various SQL, TEXT, or SCAN queries.
*/
public GridCacheQueriesEx<K, V> queries();
public CacheQueries<K, V> queries();

/**
* @param skipStore Skip store flag.
Expand Down
Expand Up @@ -170,7 +170,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
protected IgniteLogger log;

/** Queries impl. */
private GridCacheQueriesEx<K, V> qry;
private CacheQueries<K, V> qry;

/** Affinity impl. */
private Affinity<K> aff;
Expand Down Expand Up @@ -275,7 +275,7 @@ protected GridCacheAdapter(final GridCacheContext<K, V> ctx, GridCacheConcurrent

init();

qry = new GridCacheQueriesImpl<>(ctx, null);
qry = new CacheQueriesImpl<>(ctx, null);
aff = new GridCacheAffinityImpl<>(ctx);
}

Expand Down Expand Up @@ -356,7 +356,7 @@ public boolean isDht() {
public abstract GridCachePreloader<K, V> preloader();

/** {@inheritDoc} */
@Override public GridCacheQueriesEx<K, V> queries() {
@Override public CacheQueries<K, V> queries() {
return qry;
}

Expand Down
Expand Up @@ -53,7 +53,7 @@ public class GridCacheProjectionImpl<K, V> implements GridCacheProjectionEx<K, V
private GridCacheContext<K, V> cctx;

/** Queries impl. */
private GridCacheQueriesEx<K, V> qry;
private CacheQueries<K, V> qry;

/** Skip store. */
@GridToStringInclude
Expand Down Expand Up @@ -101,7 +101,7 @@ public GridCacheProjectionImpl(

cache = cctx.cache();

qry = new GridCacheQueriesImpl<>(cctx, this);
qry = new CacheQueriesImpl<>(cctx, this);

this.keepPortable = keepPortable;

Expand Down Expand Up @@ -138,7 +138,7 @@ public boolean deserializePortables() {
}

/** {@inheritDoc} */
@Override public GridCacheQueriesEx<K, V> queries() {
@Override public CacheQueries<K, V> queries() {
return qry;
}

Expand Down Expand Up @@ -754,7 +754,7 @@ public boolean deserializePortables() {

cache = cctx.cache();

qry = new GridCacheQueriesImpl<>(cctx, this);
qry = new CacheQueriesImpl<>(cctx, this);

keepPortable = in.readBoolean();
}
Expand Down
Expand Up @@ -66,7 +66,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
private GridCacheProjectionImpl<K, V> prj;

/** Cache queries. */
private GridCacheQueriesEx<K, V> qry;
private CacheQueries<K, V> qry;

/** Affinity. */
private Affinity<K> aff;
Expand Down Expand Up @@ -95,7 +95,7 @@ public GridCacheProxyImpl(GridCacheContext<K, V> ctx, GridCacheProjectionEx<K, V
gate = ctx.gate();
cache = ctx.cache();

qry = new GridCacheQueriesProxy<>(ctx, prj, (GridCacheQueriesEx<K, V>)delegate.queries());
qry = new CacheQueriesProxy<>(ctx, prj, delegate.queries());
aff = new GridCacheAffinityProxy<>(ctx, ctx.cache().affinity());
}

Expand Down Expand Up @@ -143,7 +143,7 @@ public GridCacheProjectionImpl<K, V> gateProjection() {
}

/** {@inheritDoc} */
@Override public GridCacheQueriesEx<K, V> queries() {
@Override public CacheQueries<K, V> queries() {
return qry;
}

Expand Down Expand Up @@ -1577,7 +1577,7 @@ public GridCacheProjectionImpl<K, V> gateProjection() {
gate = ctx.gate();
cache = ctx.cache();

qry = new GridCacheQueriesProxy<>(ctx, prj, (GridCacheQueriesEx<K, V>)delegate.queries());
qry = new CacheQueriesProxy<>(ctx, prj, delegate.queries());
aff = new GridCacheAffinityProxy<>(ctx, ctx.cache().affinity());
}

Expand Down
Expand Up @@ -335,7 +335,7 @@ else if (filter instanceof TextQuery) {
fut = qry.execute();
}
else if (filter instanceof SpiQuery) {
qry = ((GridCacheQueriesEx)delegate.queries()).createSpiQuery();
qry = delegate.queries().createSpiQuery();

if (grp != null)
qry.projection(grp);
Expand Down
Expand Up @@ -27,7 +27,7 @@
/**
* Extended queries interface.
*/
public interface GridCacheQueriesEx<K, V> {
public interface CacheQueries<K, V> {
/**
* Creates user's SQL fields query for given clause. For more information refer to
* {@link CacheQuery} documentation.
Expand Down
Expand Up @@ -31,9 +31,9 @@
import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.*;

/**
* {@link GridCacheQueriesEx} implementation.
* {@link CacheQueries} implementation.
*/
public class GridCacheQueriesImpl<K, V> implements GridCacheQueriesEx<K, V> {
public class CacheQueriesImpl<K, V> implements CacheQueries<K, V> {
/** */
private static final long serialVersionUID = 0L;

Expand All @@ -46,15 +46,15 @@ public class GridCacheQueriesImpl<K, V> implements GridCacheQueriesEx<K, V> {
/**
* Required by {@link Externalizable}.
*/
public GridCacheQueriesImpl() {
public CacheQueriesImpl() {
// No-op.
}

/**
* @param ctx Context.
* @param prj Projection.
*/
public GridCacheQueriesImpl(GridCacheContext<K, V> ctx, @Nullable GridCacheProjectionImpl<K, V> prj) {
public CacheQueriesImpl(GridCacheContext<K, V> ctx, @Nullable GridCacheProjectionImpl<K, V> prj) {
assert ctx != null;

this.ctx = ctx;
Expand Down
Expand Up @@ -19,7 +19,6 @@

import org.apache.ignite.*;
import org.apache.ignite.cache.query.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.lang.*;
import org.jetbrains.annotations.*;
Expand All @@ -30,7 +29,7 @@
/**
* Per-projection queries object returned to user.
*/
public class GridCacheQueriesProxy<K, V> implements GridCacheQueriesEx<K, V>, Externalizable {
public class CacheQueriesProxy<K, V> implements CacheQueries<K, V>, Externalizable {
/** */
private static final long serialVersionUID = 0L;

Expand All @@ -41,12 +40,12 @@ public class GridCacheQueriesProxy<K, V> implements GridCacheQueriesEx<K, V>, Ex
private GridCacheProjectionImpl<K, V> prj;

/** */
private GridCacheQueriesEx<K, V> delegate;
private CacheQueries<K, V> delegate;

/**
* Required by {@link Externalizable}.
*/
public GridCacheQueriesProxy() {
public CacheQueriesProxy() {
// No-op.
}

Expand All @@ -57,8 +56,8 @@ public GridCacheQueriesProxy() {
* @param prj Optional cache projection.
* @param delegate Delegate object.
*/
public GridCacheQueriesProxy(GridCacheContext<K, V> cctx, @Nullable GridCacheProjectionImpl<K, V> prj,
GridCacheQueriesEx<K, V> delegate) {
public CacheQueriesProxy(GridCacheContext<K, V> cctx, @Nullable GridCacheProjectionImpl<K, V> prj,
CacheQueries<K, V> delegate) {
assert cctx != null;
assert delegate != null;

Expand Down Expand Up @@ -194,7 +193,7 @@ public CacheProjection<K, V> projection() {
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
prj = (GridCacheProjectionImpl<K, V>)in.readObject();
delegate = (GridCacheQueriesEx<K, V>)in.readObject();
delegate = (CacheQueries<K, V>)in.readObject();

gate = prj.context().gate();
}
Expand Down
Expand Up @@ -26,7 +26,7 @@
/**
* Main API for configuring and executing cache queries.
* <p>
* Cache queries are created from {@link GridCacheQueriesEx} API via any of the available
* Cache queries are created from {@link CacheQueries} API via any of the available
* {@code createXXXQuery(...)} methods.
* <h1 class="header">SQL Queries</h1>
* {@code SQL} query allows to execute distributed cache
Expand Down Expand Up @@ -60,7 +60,7 @@
* Sometimes when it is known in advance that SQL query will cause a full data scan, or whenever data set
* is relatively small, the full scan query may be used. This query will iterate over all cache
* entries, skipping over entries that don't pass the optionally provided key-value filter
* (see {@link GridCacheQueriesEx#createScanQuery(org.apache.ignite.lang.IgniteBiPredicate)} method).
* (see {@link CacheQueries#createScanQuery(org.apache.ignite.lang.IgniteBiPredicate)} method).
* <h2 class="header">Limitations</h2>
* Data in Ignite cache is usually distributed across several nodes,
* so some queries may not work as expected. Keep in mind following limitations
Expand Down
Expand Up @@ -107,7 +107,7 @@ private JdbcDriverMetadataJob(@Nullable String cacheName) {

assert cache != null;

Collection<GridCacheSqlMetadata> metas = ((GridCacheQueriesEx<?, ?>)cache.queries()).sqlMetadata();
Collection<GridCacheSqlMetadata> metas = cache.queries().sqlMetadata();

Map<String, Map<String, Map<String, String>>> schemasMap = U.newHashMap(metas.size());

Expand Down
Expand Up @@ -61,7 +61,7 @@ private VisorCacheMetadataJob(String arg, boolean debug) {
GridCache<Object, Object> cache = ignite.cachex(cacheName);

if (cache != null) {
GridCacheQueriesEx<Object, Object> queries = (GridCacheQueriesEx<Object, Object>)cache.queries();
CacheQueries<Object, Object> queries = cache.queries();

return F.first(queries.sqlMetadata());
}
Expand Down
Expand Up @@ -182,7 +182,7 @@ public void testCacheMetaData() throws Exception {

try {
Collection<GridCacheSqlMetadata> metas =
((GridCacheQueriesEx<?, ?>)((IgniteKernal)grid(0)).getCache(null).queries()).sqlMetadata();
((IgniteKernal)grid(0)).getCache(null).queries().sqlMetadata();

assert metas != null;
assertEquals("Invalid meta: " + metas, 3, metas.size());
Expand Down Expand Up @@ -364,7 +364,7 @@ else if (cnt == 1) {

/** @throws Exception If failed. */
public void testExecuteWithMetaData() throws Exception {
CacheQuery<List<?>> qry = ((GridCacheQueriesEx<?, ?>)((IgniteKernal)grid(0)).getCache(null).queries()).createSqlFieldsQuery(
CacheQuery<List<?>> qry = ((IgniteKernal)grid(0)).getCache(null).queries().createSqlFieldsQuery(
"select p._KEY, p.name, p.age, o.name " +
"from Person p, Organization o where p.orgId = o.id",
true);
Expand Down Expand Up @@ -465,7 +465,7 @@ else if (cnt == 1) {

/** @throws Exception If failed. */
public void testSelectAllJoined() throws Exception {
CacheQuery<List<?>> qry = ((GridCacheQueriesEx<?, ?>)((IgniteKernal)grid(0)).getCache(null).queries()).createSqlFieldsQuery(
CacheQuery<List<?>> qry = ((IgniteKernal)grid(0)).getCache(null).queries().createSqlFieldsQuery(
"select * from Person p, Organization o where p.orgId = o.id",
true);

Expand Down Expand Up @@ -630,7 +630,7 @@ else if (cnt == 1) {

/** @throws Exception If failed. */
public void testEmptyResult() throws Exception {
CacheQuery<List<?>> qry = ((GridCacheQueriesEx<?, ?>)((IgniteKernal)grid(0)).getCache(null).queries()).createSqlFieldsQuery(
CacheQuery<List<?>> qry = ((IgniteKernal)grid(0)).getCache(null).queries().createSqlFieldsQuery(
"select name from Person where age = 0", true);

CacheQueryFuture<List<?>> fut = qry.execute();
Expand Down Expand Up @@ -675,7 +675,7 @@ public void testQueryString() throws Exception {

/** @throws Exception If failed. */
public void testQueryIntegersWithJoin() throws Exception {
CacheQuery<List<?>> qry = ((GridCacheQueriesEx<?, ?>)((IgniteKernal)grid(0)).getCache(null).queries()).createSqlFieldsQuery(
CacheQuery<List<?>> qry = ((IgniteKernal)grid(0)).getCache(null).queries().createSqlFieldsQuery(
"select i._KEY, i._VAL, j._KEY, j._VAL from Integer i join Integer j where i._VAL >= 100", true)
.projection(grid(0).cluster());

Expand Down Expand Up @@ -786,7 +786,7 @@ public void testNoPrimitives() throws Exception {

cache.getAndPut("key", "val");

Collection<GridCacheSqlMetadata> metas = ((GridCacheQueriesEx<?, ?>)cache.queries()).sqlMetadata();
Collection<GridCacheSqlMetadata> metas = cache.queries().sqlMetadata();

assertEquals(1, metas.size());

Expand All @@ -813,7 +813,7 @@ public void testComplexKeys() throws Exception {

cache.getAndPut(key, val);

Collection<GridCacheSqlMetadata> metas = ((GridCacheQueriesEx<?, ?>)cache.queries()).sqlMetadata();
Collection<GridCacheSqlMetadata> metas = cache.queries().sqlMetadata();

assertEquals(1, metas.size());

Expand Down
Expand Up @@ -117,9 +117,8 @@ else if (mode == CacheMode.REPLICATED)
public void _testTwoStep() throws Exception {
String cache = "partitioned";

GridCacheQueriesEx<Integer, FactPurchase> qx =
(GridCacheQueriesEx<Integer, FactPurchase>)((IgniteKernal)ignite)
.<Integer, FactPurchase>getCache(cache).queries();
CacheQueries<Integer, FactPurchase> qx =
((IgniteKernal)ignite).<Integer, FactPurchase>getCache(cache).queries();

// for (Map.Entry<Integer, FactPurchase> e : qx.createSqlQuery(FactPurchase.class, "1 = 1").execute().get())
// X.println("___ " + e);
Expand All @@ -137,9 +136,8 @@ public void _testTwoStep() throws Exception {
* @throws Exception If failed.
*/
public void testTwoStepGroupAndAggregates() throws Exception {
GridCacheQueriesEx<Integer, FactPurchase> qx =
(GridCacheQueriesEx<Integer, FactPurchase>)((IgniteKernal)ignite)
.<Integer, FactPurchase>getCache("partitioned").queries();
CacheQueries<Integer, FactPurchase> qx =
((IgniteKernal)ignite).<Integer, FactPurchase>getCache("partitioned").queries();

Set<Integer> set1 = new HashSet<>();

Expand Down

0 comments on commit 0920bcf

Please sign in to comment.