http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/events/CacheQueryExecutedEvent.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/events/CacheQueryExecutedEvent.java index 0000000,d44ebd8..2733d64 mode 000000,100644..100644 --- a/modules/core/src/main/java/org/apache/ignite/events/CacheQueryExecutedEvent.java +++ b/modules/core/src/main/java/org/apache/ignite/events/CacheQueryExecutedEvent.java @@@ -1,0 -1,237 +1,239 @@@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.apache.ignite.events; + + import org.apache.ignite.cache.query.*; + import org.apache.ignite.cluster.*; ++import org.apache.ignite.internal.processors.cache.query.*; ++import org.apache.ignite.lang.*; + import org.apache.ignite.internal.util.tostring.*; + import org.apache.ignite.internal.util.typedef.internal.*; + import org.apache.ignite.lang.*; + import org.jetbrains.annotations.*; + + import java.util.*; + + /** + * Cache query execution event. + * <p> + * Grid events are used for notification about what happens within the grid. Note that by + * design Ignite keeps all events generated on the local node locally and it provides + * APIs for performing a distributed queries across multiple nodes: + * <ul> + * <li> + * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - + * asynchronously querying events occurred on the nodes specified, including remote nodes. + * </li> + * <li> + * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - + * querying only local events stored on this local node. + * </li> + * <li> + * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - + * listening to local grid events (events from remote nodes not included). + * </li> + * </ul> + * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. + * <h1 class="header">Events and Performance</h1> + * Note that by default all events in Ignite are enabled and therefore generated and stored + * by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds + * under the load and therefore it creates a significant additional load on the system. If these events are + * not needed by the application this load is unnecessary and leads to significant performance degradation. + * <p> + * It is <b>highly recommended</b> to enable only those events that your application logic requires + * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in Ignite configuration. Note that certain + * events are required for Ignite's internal operations and such events will still be generated but not stored by + * event storage SPI if they are disabled in Ignite configuration. + * + * @see EventType#EVT_CACHE_QUERY_EXECUTED + * @see EventType#EVTS_CACHE_QUERY + */ + public class CacheQueryExecutedEvent<K, V> extends EventAdapter { + /** */ + private static final long serialVersionUID = 3738753361235304496L; + + /** Query type. */ + private final CacheQueryType qryType; + + /** Cache name. */ + private final String cacheName; + + /** Class name. */ + private final String clsName; + + /** Clause. */ + private final String clause; + + /** Scan query filter. */ + @GridToStringInclude + private final IgniteBiPredicate<K, V> scanQryFilter; + + /** Continuous query filter. */ + @GridToStringInclude + private final IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter; + + /** Query arguments. */ + @GridToStringInclude + private final Object[] args; + + /** Security subject ID. */ + private final UUID subjId; + + /** Task name. */ + private final String taskName; + + /** + * @param node Node where event was fired. + * @param msg Event message. + * @param type Event type. + * @param qryType Query type. + * @param cacheName Cache name. + * @param clsName Class name. + * @param clause Clause. + * @param scanQryFilter Scan query filter. + * @param args Query arguments. + * @param subjId Security subject ID. + */ + public CacheQueryExecutedEvent( + ClusterNode node, + String msg, + int type, + CacheQueryType qryType, + @Nullable String cacheName, + @Nullable String clsName, + @Nullable String clause, + @Nullable IgniteBiPredicate<K, V> scanQryFilter, + @Nullable IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter, + @Nullable Object[] args, + @Nullable UUID subjId, + @Nullable String taskName) { + super(node, msg, type); + + assert qryType != null; + + this.qryType = qryType; + this.cacheName = cacheName; + this.clsName = clsName; + this.clause = clause; + this.scanQryFilter = scanQryFilter; + this.contQryFilter = contQryFilter; + this.args = args; + this.subjId = subjId; + this.taskName = taskName; + } + + /** + * Gets query type. + * + * @return Query type. + */ + public CacheQueryType queryType() { + return qryType; + } + + /** + * Gets cache name on which query was executed. + * + * @return Cache name. + */ + @Nullable public String cacheName() { + return cacheName; + } + + /** + * Gets queried class name. + * <p> + * Applicable for {@code SQL} and @{code full text} queries. + * + * @return Queried class name. + */ + @Nullable public String className() { + return clsName; + } + + /** + * Gets query clause. + * <p> + * Applicable for {@code SQL}, {@code SQL fields} and @{code full text} queries. + * + * @return Query clause. + */ + @Nullable public String clause() { + return clause; + } + + /** + * Gets scan query filter. + * <p> + * Applicable for {@code scan} queries. + * + * @return Scan query filter. + */ + @Nullable public IgniteBiPredicate<K, V> scanQueryFilter() { + return scanQryFilter; + } + + /** + * Gets continuous query filter. + * <p> + * Applicable for {@code continuous} queries. + * + * @return Continuous query filter. + */ + @Nullable public IgnitePredicate<CacheContinuousQueryEntry<K, V>> continuousQueryFilter() { + return contQryFilter; + } + + /** + * Gets query arguments. + * <p> + * Applicable for {@code SQL} and {@code SQL fields} queries. + * + * @return Query arguments. + */ + @Nullable public Object[] arguments() { + return args; + } + + /** + * Gets security subject ID. + * + * @return Security subject ID. + */ + @Nullable public UUID subjectId() { + return subjId; + } + + /** + * Gets the name of the task that executed the query (if any). + * + * @return Task name. + */ + @Nullable public String taskName() { + return taskName; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(CacheQueryExecutedEvent.class, this, + "nodeId8", U.id8(node().id()), + "msg", message(), + "type", name(), + "tstamp", timestamp()); + } + }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java index 0000000,cd0ff4c..322feff mode 000000,100644..100644 --- a/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java +++ b/modules/core/src/main/java/org/apache/ignite/events/CacheQueryReadEvent.java @@@ -1,0 -1,299 +1,301 @@@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.apache.ignite.events; + + import org.apache.ignite.cache.query.*; + import org.apache.ignite.cluster.*; ++import org.apache.ignite.internal.processors.cache.query.*; ++import org.apache.ignite.lang.*; + import org.apache.ignite.internal.util.tostring.*; + import org.apache.ignite.internal.util.typedef.internal.*; + import org.apache.ignite.lang.*; + import org.jetbrains.annotations.*; + + import java.util.*; + + /** + * Cache query read event. + * <p> + * Grid events are used for notification about what happens within the grid. Note that by + * design Ignite keeps all events generated on the local node locally and it provides + * APIs for performing a distributed queries across multiple nodes: + * <ul> + * <li> + * {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - + * asynchronously querying events occurred on the nodes specified, including remote nodes. + * </li> + * <li> + * {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - + * querying only local events stored on this local node. + * </li> + * <li> + * {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - + * listening to local grid events (events from remote nodes not included). + * </li> + * </ul> + * User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. + * <h1 class="header">Events and Performance</h1> + * Note that by default all events in Ignite are enabled and therefore generated and stored + * by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds + * under the load and therefore it creates a significant additional load on the system. If these events are + * not needed by the application this load is unnecessary and leads to significant performance degradation. + * <p> + * It is <b>highly recommended</b> to enable only those events that your application logic requires + * by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in Ignite configuration. Note that certain + * events are required for Ignite's internal operations and such events will still be generated but not stored by + * event storage SPI if they are disabled in Ignite configuration. + * + * @see EventType#EVT_CACHE_QUERY_OBJECT_READ + * @see EventType#EVTS_CACHE_QUERY + */ + public class CacheQueryReadEvent<K, V> extends EventAdapter { + /** */ + private static final long serialVersionUID = -1984731272984397445L; + + /** Query type. */ + private final CacheQueryType qryType; + + /** Cache name. */ + private final String cacheName; + + /** Class name. */ + private final String clsName; + + /** Clause. */ + private final String clause; + + /** Scan query filter. */ + @GridToStringInclude + private final IgniteBiPredicate<K, V> scanQryFilter; + + /** Continuous query filter. */ + @GridToStringInclude + private final IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter; + + /** Query arguments. */ + @GridToStringInclude + private final Object[] args; + + /** Security subject ID. */ + private final UUID subjId; + + /** Task name. */ + private final String taskName; + + /** Key. */ + @GridToStringInclude + private final K key; + + /** Value. */ + @GridToStringInclude + private final V val; + + /** Old value. */ + @GridToStringInclude + private final V oldVal; + + /** Result row. */ + @GridToStringInclude + private final Object row; + + /** + * @param node Node where event was fired. + * @param msg Event message. + * @param type Event type. + * @param cacheName Cache name. + * @param clsName Class name. + * @param clause Clause. + * @param scanQryFilter Scan query filter. + * @param args Query arguments. + * @param subjId Security subject ID. + * @param key Key. + * @param val Value. + * @param oldVal Old value. + */ + public CacheQueryReadEvent( + ClusterNode node, + String msg, + int type, + CacheQueryType qryType, + @Nullable String cacheName, + @Nullable String clsName, + @Nullable String clause, + @Nullable IgniteBiPredicate<K, V> scanQryFilter, + @Nullable IgnitePredicate<CacheContinuousQueryEntry<K, V>> contQryFilter, + @Nullable Object[] args, + @Nullable UUID subjId, + @Nullable String taskName, + @Nullable K key, + @Nullable V val, + @Nullable V oldVal, + @Nullable Object row) { + super(node, msg, type); + + assert qryType != null; + + this.qryType = qryType; + this.cacheName = cacheName; + this.clsName = clsName; + this.clause = clause; + this.scanQryFilter = scanQryFilter; + this.contQryFilter = contQryFilter; + this.args = args; + this.subjId = subjId; + this.taskName = taskName; + this.key = key; + this.val = val; + this.oldVal = oldVal; + this.row = row; + } + + /** + * Gets query type. + * + * @return Query type. + */ + public CacheQueryType queryType() { + return qryType; + } + + /** + * Gets cache name on which query was executed. + * + * @return Cache name. + */ + @Nullable public String cacheName() { + return cacheName; + } + + /** + * Gets queried class name. + * <p> + * Applicable for {@code SQL} and @{code full text} queries. + * + * @return Queried class name. + */ + @Nullable public String className() { + return clsName; + } + + /** + * Gets query clause. + * <p> + * Applicable for {@code SQL}, {@code SQL fields} and @{code full text} queries. + * + * @return Query clause. + */ + @Nullable public String clause() { + return clause; + } + + /** + * Gets scan query filter. + * <p> + * Applicable for {@code scan} queries. + * + * @return Scan query filter. + */ + @Nullable public IgniteBiPredicate<K, V> scanQueryFilter() { + return scanQryFilter; + } + + /** + * Gets continuous query filter. + * <p> + * Applicable for {@code continuous} queries. + * + * @return Continuous query filter. + */ + @Nullable public IgnitePredicate<CacheContinuousQueryEntry<K, V>> continuousQueryFilter() { + return contQryFilter; + } + + /** + * Gets query arguments. + * <p> + * Applicable for {@code SQL} and {@code SQL fields} queries. + * + * @return Query arguments. + */ + @Nullable public Object[] arguments() { + return args; + } + + /** + * Gets security subject ID. + * + * @return Security subject ID. + */ + @Nullable public UUID subjectId() { + return subjId; + } + + /** + * Gets the name of the task that executed the query (if any). + * + * @return Task name. + */ + @Nullable public String taskName() { + return taskName; + } + + /** + * Gets read entry key. + * + * @return Key. + */ + @Nullable public K key() { + return key; + } + + /** + * Gets read entry value. + * + * @return Value. + */ + @Nullable public V value() { + return val; + } + + /** + * Gets read entry old value (applicable for continuous queries). + * + * @return Old value. + */ + @Nullable public V oldValue() { + return oldVal; + } + + /** + * Gets read results set row. + * + * @return Result row. + */ + @Nullable public Object row() { + return row; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(CacheQueryReadEvent.class, this, + "nodeId8", U.id8(node().id()), + "msg", message(), + "type", name(), + "tstamp", timestamp()); + } + } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index c2ee5ac,fbd0d9c..7f83ec3 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@@ -20,10 -20,8 +20,11 @@@ package org.apache.ignite.internal.proc import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.query.*; +import org.apache.ignite.cluster.*; + import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; +import org.apache.ignite.internal.processors.cache.query.*; +import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java index ceac0f5,0000000..4dad74c mode 100644,000000..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 @@@ -1,153 -1,0 +1,153 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.query; + +import org.apache.ignite.cache.query.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.lang.*; +import org.jetbrains.annotations.*; + +import java.util.*; + +/** + * Facade for creating distributed queries. It contains various {@code 'createXxxQuery(..)'} + * methods for {@code SQL}, {@code TEXT}, and {@code SCAN} query creation (see {@link CacheQuery} + * for more information). + * <p> + * Instance of {@code CacheQueries} is obtained from cache projection as follows: + * <pre name="code" class="java"> - * CacheQueries q = GridGain.grid().cache("myCache").queries(); ++ * CacheQueries q = Ignition.ignite().cache("myCache").queries(); + * </pre> + */ +public interface CacheQueries<K, V> { + /** + * Creates user's SQL query, queried class, and query clause which is generally + * a where clause. For more information refer to {@link CacheQuery} documentation. + * + * @param cls Query class. + * @param clause Query clause. + * @return Created query. + */ + public CacheQuery<Map.Entry<K, V>> createSqlQuery(Class<?> cls, String clause); + + /** + * Creates user's SQL query, queried class, and query clause which is generally + * a where clause. For more information refer to {@link CacheQuery} documentation. + * + * @param clsName Query class name. + * @param clause Query clause. + * @return Created query. + */ + public CacheQuery<Map.Entry<K, V>> createSqlQuery(String clsName, String clause); + + /** + * Creates user's SQL fields query for given clause. For more information refer to + * {@link CacheQuery} documentation. + * + * @param qry Query. + * @return Created query. + */ + public CacheQuery<List<?>> createSqlFieldsQuery(String qry); + + /** + * Creates user's full text query, queried class, and query clause. + * For more information refer to {@link CacheQuery} documentation. + * + * @param clsName Query class name. + * @param search Search clause. + * @return Created query. + */ + public CacheQuery<Map.Entry<K, V>> createFullTextQuery(String clsName, String search); + + /** + * Creates user's full text query, queried class, and query clause. + * For more information refer to {@link CacheQuery} documentation. + * + * @param cls Query class. + * @param search Search clause. + * @return Created query. + */ + public CacheQuery<Map.Entry<K, V>> createFullTextQuery(Class<?> cls, String search); + + /** + * Creates user's predicate based scan query. + * + * @param filter Scan filter. + * @return Created query. + */ + public CacheQuery<Map.Entry<K, V>> createScanQuery(@Nullable IgniteBiPredicate<K, V> filter); + + /** + * Creates new continuous query. + * <p> + * For more information refer to {@link org.apache.ignite.cache.query.CacheContinuousQuery} documentation. + * + * @return Created continuous query. + * @see org.apache.ignite.cache.query.CacheContinuousQuery + */ + public CacheContinuousQuery<K, V> createContinuousQuery(); + + /** + * Forces this cache to rebuild all search indexes of given value type. Sometimes indexes + * may hold references to objects that have already been removed from cache. Although + * not affecting query results, these objects may consume extra memory. Rebuilding + * indexes will remove any redundant references that may have temporarily got stuck + * inside in-memory index. + * + * @param cls Value type to rebuild indexes for. + * + * @return Future that will be completed when rebuilding of all indexes is finished. + */ + public IgniteInternalFuture<?> rebuildIndexes(Class<?> cls); + + /** + * Forces this cache to rebuild all search indexes of given value type. Sometimes indexes + * may hold references to objects that have already been removed from cache. Although + * not affecting query results, these objects may consume extra memory. Rebuilding + * indexes will remove any redundant references that may have temporarily got stuck + * inside in-memory index. + * + * @param typeName Value type name to rebuild indexes for. + * + * @return Future that will be completed when rebuilding of all indexes is finished. + */ + public IgniteInternalFuture<?> rebuildIndexes(String typeName); + + /** + * Forces this cache to rebuild search indexes of all types. Sometimes indexes + * may hold references to objects that have already been removed from cache. Although + * not affecting query results, these objects may consume extra memory. Rebuilding + * indexes will remove any redundant references that may have temporarily got stuck + * inside in-memory index. + * + * @return Future that will be completed when rebuilding of all indexes is finished. + */ + public IgniteInternalFuture<?> rebuildAllIndexes(); + + /** + * Accumulated metrics for all queries executed for this cache. + * + * @return Cache query metrics. + */ + public QueryMetrics metrics(); + + /** + * Resets accumulated metrics. + */ + public void resetMetrics(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java index 0468b93,0000000..4e1ceba mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java @@@ -1,295 -1,0 +1,295 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.query; + +import org.apache.ignite.cache.query.*; +import org.apache.ignite.cluster.*; +import org.apache.ignite.lang.*; +import org.jetbrains.annotations.*; + +/** + * Main API for configuring and executing cache queries. + * <p> + * 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 + * queries using standard SQL syntax. All values participating in where clauses + * or joins must be annotated with {@link QuerySqlField} annotation. Query can be created + * with {@link CacheQueries#createSqlQuery(Class, String)} method. + * <h2 class="header">Field Queries</h2> + * By default {@code select} clause is ignored as query result contains full objects. + * If it is needed to select individual fields, use {@link CacheQueries#createSqlFieldsQuery(String)} method. + * This type of query replaces full objects with individual fields. Note that selected fields + * must be annotated with {@link QuerySqlField} annotation. + * <h2 class="header">Cross-Cache Queries</h2> + * You are allowed to query data from several caches. Cache that this query was created on is + * treated as default schema in this case. Other caches can be referenced by their names. + * <p> + * Note that cache name is case sensitive and has to always be specified in double quotes. + * Here is an example of cross cache query (note that 'replicated' and 'partitioned' are + * cache names for replicated and partitioned caches accordingly): + * <pre name="code" class="java"> + * CacheQuery<Map.Entry<Integer, FactPurchase>> storePurchases = cache.queries().createSqlQuery( + * Purchase.class, + * "from \"replicated\".Store, \"partitioned\".Purchase where Store.id=Purchase.storeId and Store.id=?"); + * </pre> + * <h2 class="header">Custom functions in SQL queries.</h2> + * It is possible to write custom Java methods and call then form SQL queries. These methods must be public static + * and annotated with {@link QuerySqlFunction}. Classes containing these methods must be registered in - * {@link org.apache.ignite.configuration.IgniteQueryConfiguration#setIndexCustomFunctionClasses(Class[])}. ++ * {@link org.apache.ignite.configuration.QueryConfiguration#setIndexCustomFunctionClasses(Class[])}. + * <h1 class="header">Full Text Queries</h1> - * GridGain supports full text queries based on Apache Lucene engine. This queries are created by ++ * Ignite supports full text queries based on Apache Lucene engine. This queries are created by + * {@link CacheQueries#createFullTextQuery(Class, String)} method. Note that all fields that + * are expected to show up in text query results must be annotated with {@link QueryTextField} + * annotation. + * <h1 class="header">Scan Queries</h1> + * 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 CacheQueries#createScanQuery(org.apache.ignite.lang.IgniteBiPredicate)} method). + * <h2 class="header">Limitations</h2> - * Data in GridGain cache is usually distributed across several nodes, ++ * Data in Ignite cache is usually distributed across several nodes, + * so some queries may not work as expected. Keep in mind following limitations + * (not applied if data is queried from one node only): + * <ul> + * <li> + * {@code Group by} and {@code sort by} statements are applied separately + * on each node, so result set will likely be incorrectly grouped or sorted + * after results from multiple remote nodes are grouped together. + * </li> + * <li> + * Aggregation functions like {@code sum}, {@code max}, {@code avg}, etc. + * are also applied on each node. Therefore you will get several results + * containing aggregated values, one for each node. + * </li> + * <li> + * Joins will work correctly only if joined objects are stored in + * collocated mode or at least one side of the join is stored in + * {@link org.apache.ignite.cache.CacheMode#REPLICATED} cache. Refer to + * {@link org.apache.ignite.cache.affinity.CacheAffinityKey} javadoc for more information about colocation. + * </li> + * </ul> + * <h1 class="header">Query usage</h1> + * As an example, suppose we have data model consisting of {@code 'Employee'} and {@code 'Organization'} + * classes defined as follows: + * <pre name="code" class="java"> + * public class Organization { + * // Indexed field. + * @CacheQuerySqlField(index = true) + * private long id; + * + * // Indexed field. + * @CacheQuerySqlField(index = true) + * private String name; + * ... + * } + * + * public class Person { + * // Indexed field. + * @CacheQuerySqlField(index = true) + * private long id; + * + * // Indexed field (Organization ID, used as a foreign key). + * @CacheQuerySqlField(index = true) + * private long orgId; + * + * // Without SQL field annotation, this field cannot be used in queries. + * private String name; + * + * // Not indexed field. + * @CacheQuerySqlField + * private double salary; + * + * // Index for text search. + * @CacheQueryTextField + * private String resume; + * ... + * } + * </pre> + * Then you can create and execute queries that check various salary ranges like so: + * <pre name="code" class="java"> + * Cache<Long, Person> cache = G.grid().cache(); + * ... + * // Create query which selects salaries based on range for all employees + * // that work for a certain company. + * CacheQuery<Map.Entry<Long, Person>> qry = cache.queries().createSqlQuery(Person.class, + * "from Person, Organization where Person.orgId = Organization.id " + + * "and Organization.name = ? and Person.salary > ? and Person.salary <= ?"); + * - * // Query all nodes to find all cached GridGain employees ++ * // Query all nodes to find all cached Ignite employees + * // with salaries less than 1000. - * qry.execute("GridGain", 0, 1000); ++ * qry.execute("Ignition", 0, 1000); + * - * // Query only remote nodes to find all remotely cached GridGain employees ++ * // Query only remote nodes to find all remotely cached Ignite employees + * // with salaries greater than 1000 and less than 2000. - * qry.projection(grid.remoteProjection()).execute("GridGain", 1000, 2000); ++ * qry.projection(grid.remoteProjection()).execute("Ignition", 1000, 2000); + * </pre> + * Here is a possible query that will use Lucene text search to scan all resumes to + * check if employees have {@code Master} degree: + * <pre name="code" class="java"> + * CacheQuery<Map.Entry<Long, Person>> mastersQry = + * cache.queries().createFullTextQuery(Person.class, "Master"); + * + * // Query all cache nodes. + * mastersQry.execute(); + * </pre> + * <h1 class="header">Geo-Spatial Indexes and Queries</h1> - * GridGain also support <b>Geo-Spatial Indexes</b>. Here is an example of geo-spatial index: ++ * Ignite also support <b>Geo-Spatial Indexes</b>. Here is an example of geo-spatial index: + * <pre name="code" class="java"> + * private class MapPoint implements Serializable { + * // Geospatial index. + * @CacheQuerySqlField(index = true) + * private com.vividsolutions.jts.geom.Point location; + * + * // Not indexed field. + * @CacheQuerySqlField + * private String name; + * + * public MapPoint(com.vividsolutions.jts.geom.Point location, String name) { + * this.location = location; + * this.name = name; + * } + * } + * </pre> + * Example of spatial query on the geo-indexed field from above: + * <pre name="code" class="java"> + * com.vividsolutions.jts.geom.GeometryFactory factory = new com.vividsolutions.jts.geom.GeometryFactory(); + * + * com.vividsolutions.jts.geom.Polygon square = factory.createPolygon(new Coordinate[] { + * new com.vividsolutions.jts.geom.Coordinate(0, 0), + * new com.vividsolutions.jts.geom.Coordinate(0, 100), + * new com.vividsolutions.jts.geom.Coordinate(100, 100), + * new com.vividsolutions.jts.geom.Coordinate(100, 0), + * new com.vividsolutions.jts.geom.Coordinate(0, 0) + * }); + * + * Map.Entry<String, UserData> records = cache.queries().createSqlQuery(MapPoint.class, "select * from MapPoint where location && ?") + * .queryArguments(square) + * .execute() + * .get(); + * </pre> + */ +public interface CacheQuery<T> { + /** Default query page size. */ + public static final int DFLT_PAGE_SIZE = 1024; + + /** + * Sets result page size. If not provided, {@link #DFLT_PAGE_SIZE} will be used. + * Results are returned from queried nodes one page at a tme. + * + * @param pageSize Page size. + * @return {@code this} query instance for chaining. + */ + public CacheQuery<T> pageSize(int pageSize); + + /** + * Sets query timeout. {@code 0} means there is no timeout (this + * is a default value). + * + * @param timeout Query timeout. + * @return {@code this} query instance for chaining. + */ + public CacheQuery<T> timeout(long timeout); + + /** + * Sets whether or not to keep all query results local. If not - only the current page + * is kept locally. Default value is {@code true}. + * + * @param keepAll Keep results or not. + * @return {@code this} query instance for chaining. + */ + public CacheQuery<T> keepAll(boolean keepAll); + + /** + * Sets whether or not to include backup entries into query result. This flag + * is {@code false} by default. + * + * @param incBackups Query {@code includeBackups} flag. + * @return {@code this} query instance for chaining. + */ + public CacheQuery<T> includeBackups(boolean incBackups); + + /** + * Sets whether or not to deduplicate query result set. If this flag is {@code true} + * then query result will not contain some key more than once even if several nodes + * returned entries with the same keys. Default value is {@code false}. + * + * @param dedup Query {@code enableDedup} flag. + * @return {@code this} query instance for chaining. + */ + public CacheQuery<T> enableDedup(boolean dedup); + + /** + * Sets optional grid projection to execute this query on. + * + * @param prj Projection. + * @return {@code this} query instance for chaining. + */ + public CacheQuery<T> projection(ClusterGroup prj); + + /** + * Executes the query and returns the query future. Caller may decide to iterate + * over the returned future directly in which case the iterator may block until + * the next value will become available, or wait for the whole query to finish + * by calling any of the {@code 'get(..)'} methods on the returned future. If + * {@link #keepAll(boolean)} flag is set to {@code false}, then {@code 'get(..)'} + * methods will only return the last page received, otherwise all pages will be + * accumulated and returned to user as a collection. + * <p> + * Note that if the passed in grid projection is a local node, then query + * will be executed locally without distribution to other nodes. + * <p> + * Also note that query state cannot be changed (clause, timeout etc.), except + * arguments, if this method was called at least once. + * + * @param args Optional arguments. + * @return Future for the query result. + */ + public CacheQueryFuture<T> execute(@Nullable Object... args); + + /** + * Executes the query the same way as {@link #execute(Object...)} method but reduces result remotely. + * + * @param rmtReducer Remote reducer. + * @param args Optional arguments. + * @return Future for the query result. + */ + public <R> CacheQueryFuture<R> execute(IgniteReducer<T, R> rmtReducer, @Nullable Object... args); + + /** + * Executes the query the same way as {@link #execute(Object...)} method but transforms result remotely. + * + * @param rmtTransform Remote transformer. + * @param args Optional arguments. + * @return Future for the query result. + */ + public <R> CacheQueryFuture<R> execute(IgniteClosure<T, R> rmtTransform, @Nullable Object... args); + + /** + * Gets metrics for this query. + * + * @return Query metrics. + */ + public QueryMetrics metrics(); + + /** + * Resets metrics for this query. + */ + public void resetMetrics(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java index eab3e6d,0000000..fa0f3df mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java @@@ -1,47 -1,0 +1,47 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.query; + +/** + * Cache query type. + * <p> - * Used in {@link org.apache.ignite.events.IgniteCacheQueryExecutedEvent} and {@link org.apache.ignite.events.IgniteCacheQueryReadEvent} ++ * Used in {@link org.apache.ignite.events.CacheQueryExecutedEvent} and {@link org.apache.ignite.events.CacheQueryReadEvent} + * to identify the type of query for which an event was fired. + * - * @see org.apache.ignite.events.IgniteCacheQueryExecutedEvent#queryType() - * @see org.apache.ignite.events.IgniteCacheQueryReadEvent#queryType() ++ * @see org.apache.ignite.events.CacheQueryExecutedEvent#queryType() ++ * @see org.apache.ignite.events.CacheQueryReadEvent#queryType() + */ +public enum CacheQueryType { + /** SQL query. */ + SQL, + + /** SQL fields query. */ + SQL_FIELDS, + + /** Full text query. */ + FULL_TEXT, + + /** Scan query. */ + SCAN, + + /** Continuous query. */ + CONTINUOUS, + + /** SPI query. */ + SPI +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryHandler.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java index 93117bf,0000000..43ee43b mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingSpi.java @@@ -1,113 -1,0 +1,113 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.spi.indexing; + +import org.apache.ignite.spi.*; +import org.jetbrains.annotations.*; + +import javax.cache.*; +import java.util.*; + +/** + * Indexing SPI allows user to index cache content. Using indexing SPI user can index data in cache and run + * Usually cache name will be used as space name, so multiple caches can write to single indexing SPI instance. + * <p> + * <b>NOTE:</b> this SPI (i.e. methods in this interface) should never be used directly. SPIs provide - * internal view on the subsystem and is used internally by GridGain kernal. In rare use cases when ++ * internal view on the subsystem and is used internally by Ignite kernal. In rare use cases when + * access to a specific implementation of this SPI is required - an instance of this SPI can be obtained + * via {@link org.apache.ignite.Ignite#configuration()} method to check its configuration properties or call other non-SPI + * methods. Note again that calling methods from this interface on the obtained instance can lead + * to undefined behavior and explicitly not supported. + * + * Here is a Java example on how to configure SPI. + * <pre name="code" class="java"> + * GridIndexingSpi spi = new MyIndexingSpi(); + * + * GridConfiguration cfg = new GridConfiguration(); + * + * // Overrides default indexing SPI. + * cfg.setIndexingSpi(spi); + * + * // Starts grid. + * G.start(cfg); + * </pre> + * Here is an example of how to configure SPI from Spring XML configuration file. + * <pre name="code" class="xml"> + * <property name="indexingSpi"> + * <bean class="com.example.MyIndexingSpi"> + * </bean> + * </property> + * </pre> + * <p> + * <img src="http://www.gridgain.com/images/spring-small.png"> + * <br> + * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a> + */ +public interface IndexingSpi extends IgniteSpi { + /** + * Executes query. + * + * @param spaceName Space name. + * @param params Query parameters. + * @param filters System filters. + * @return Query result. If the iterator implements {@link AutoCloseable} it will be correctly closed. + * @throws IgniteSpiException If failed. + */ + public Iterator<Cache.Entry<?,?>> query(@Nullable String spaceName, Collection<Object> params, + @Nullable IndexingQueryFilter filters) throws IgniteSpiException; + + /** + * Updates index. Note that key is unique for space, so if space contains multiple indexes + * the key should be removed from indexes other than one being updated. + * + * @param spaceName Space name. + * @param key Key. + * @param val Value. + * @param expirationTime Expiration time or 0 if never expires. + * @throws IgniteSpiException If failed. + */ + public void store(@Nullable String spaceName, Object key, Object val, long expirationTime) throws IgniteSpiException; + + /** + * Removes index entry by key. + * + * @param spaceName Space name. + * @param key Key. + * @throws IgniteSpiException If failed. + */ + public void remove(@Nullable String spaceName, Object key) throws IgniteSpiException; + + /** + * Will be called when entry with given key is swapped. + * + * @param spaceName Space name. + * @param key Key. + * @throws IgniteSpiException If failed. + */ + public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException; + + /** + * Will be called when entry with given key is unswapped. + * + * @param spaceName Space name. + * @param key Key. + * @param val Value. + * @throws IgniteSpiException If failed. + */ + public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException; +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/config/log4j-test.xml ---------------------------------------------------------------------- diff --cc modules/core/src/test/config/log4j-test.xml index 2712d59,8098c0e..29ae7b6 --- a/modules/core/src/test/config/log4j-test.xml +++ b/modules/core/src/test/config/log4j-test.xml @@@ -84,14 -84,8 +84,14 @@@ </category> --> + <!-- + <category name="org.apache.ignite.internal.processors.query"> + <level value="DEBUG"/> + </category> + --> + - <!-- Enable Gridgain debugging. - <category name="org.gridgain"> + <!-- Enable Ignite debugging. + <category name="org.apache.ignite"> <level value="DEBUG"/> </category> --> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java index 9e3fee0,6d49795..8252519 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java @@@ -18,9 -18,9 +18,10 @@@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.*; -import org.apache.ignite.cache.query.*; +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.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java index c1b68ae,3c0bbaa..e54f464 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java @@@ -19,7 -19,8 +19,8 @@@ package org.apache.ignite.internal.proc import org.apache.ignite.*; import org.apache.ignite.cache.*; -import org.apache.ignite.cache.query.*; +import org.apache.ignite.internal.processors.cache.query.*; + import org.apache.ignite.configuration.*; import org.apache.ignite.testframework.*; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java index eeef1a5,0000000..67bf4ce mode 100644,000000..100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java @@@ -1,82 -1,0 +1,81 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + - import org.apache.ignite.cache.*; +import org.apache.ignite.cache.query.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.testframework.junits.common.*; + +import javax.cache.*; +import java.util.*; + +import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; + +/** + * Test for local query on partitioned cache without data. + */ +public class IgniteCacheFieldsQueryNoDataSelfTest extends GridCommonAbstractTest { + /** IP finder. */ + private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + CacheConfiguration cache = defaultCacheConfiguration(); + + cache.setCacheMode(PARTITIONED); + cache.setBackups(1); + cache.setWriteSynchronizationMode(FULL_SYNC); + + cfg.setCacheConfiguration(cache); + + TcpDiscoverySpi disco = new TcpDiscoverySpi(); + + disco.setIpFinder(IP_FINDER); + + cfg.setDiscoverySpi(disco); + + return cfg; + } + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + startGrid(); + } + + /** {@inheritDoc} */ + @Override protected void afterTestsStopped() throws Exception { + stopGrid(); + } + + /** + * @throws Exception If failed. + */ + public void testQuery() throws Exception { + Collection<Cache.Entry<Object, Object>> res = grid().jcache(null) + .query(new QuerySqlPredicate("select _VAL from Integer")).getAll(); + + assert res != null; + assert res.isEmpty(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index 9b81147,09e2d2a..ab65c33 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@@ -54,8 -54,8 +54,8 @@@ import static org.apache.ignite.cache.C import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.cache.query.CacheQueryType.*; +import static org.apache.ignite.internal.processors.cache.query.CacheQueryType.*; - import static org.apache.ignite.events.IgniteEventType.*; + import static org.apache.ignite.events.EventType.*; /** * Continuous queries tests. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/core/src/test/webapp/META-INF/gg-config.xml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlColumn.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReduceQueryMultithreadedSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4829aab8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java ----------------------------------------------------------------------