ignite-sql-tests - rename
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c9e2e5e2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c9e2e5e2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c9e2e5e2 Branch: refs/heads/ignite-sql-tests Commit: c9e2e5e23b1737102b492cdc7d74a31d94684b94 Parents: 9a694ab Author: S.Vladykin <svlady...@gridgain.com> Authored: Sun Feb 8 17:33:20 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Sun Feb 8 17:33:20 2015 +0300 ---------------------------------------------------------------------- .../java/org/apache/ignite/IgniteCache.java | 32 +-- .../org/apache/ignite/cache/query/Query.java | 140 +++++++++++++ .../ignite/cache/query/QueryContinuous.java | 205 +++++++++++++++++++ .../cache/query/QueryContinuousPredicate.java | 205 ------------------- .../ignite/cache/query/QueryPredicate.java | 140 ------------- .../apache/ignite/cache/query/QueryScan.java | 69 +++++++ .../ignite/cache/query/QueryScanPredicate.java | 69 ------- .../org/apache/ignite/cache/query/QuerySpi.java | 49 +++++ .../ignite/cache/query/QuerySpiPredicate.java | 49 ----- .../org/apache/ignite/cache/query/QuerySql.java | 150 ++++++++++++++ .../ignite/cache/query/QuerySqlPredicate.java | 150 -------------- .../apache/ignite/cache/query/QueryText.java | 113 ++++++++++ .../ignite/cache/query/QueryTextPredicate.java | 113 ---------- .../processors/cache/IgniteCacheProxy.java | 28 +-- .../IgniteCacheFieldsQueryNoDataSelfTest.java | 2 +- .../cache/IgniteCacheQueryIndexSelfTest.java | 2 +- ...hePartitionedQueryMultiThreadedSelfTest.java | 2 +- .../IgniteCacheAbstractFieldsQuerySelfTest.java | 32 +-- .../cache/IgniteCacheAbstractQuerySelfTest.java | 68 +++--- .../cache/IgniteCacheQueryLoadSelfTest.java | 8 +- .../IgniteCacheQueryMultiThreadedSelfTest.java | 26 +-- ...gniteCacheSqlQueryMultiThreadedSelfTest.java | 3 +- .../IgniteCacheAtomicFieldsQuerySelfTest.java | 2 +- .../IgniteCachePartitionedQuerySelfTest.java | 8 +- .../IgniteCacheQueryNodeRestartSelfTest.java | 2 +- ...gniteCacheReplicatedFieldsQuerySelfTest.java | 2 +- .../IgniteCacheReplicatedQuerySelfTest.java | 16 +- .../local/IgniteCacheLocalQuerySelfTest.java | 4 +- 28 files changed, 848 insertions(+), 841 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/IgniteCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java index f66129f..1f0a997 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java @@ -195,36 +195,44 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS public boolean isLocalLocked(K key, boolean byCurrThread); /** - * Queries cache with given predicate. + * Queries cache. Accepts any subclass of {@link Query}. * - * @param filter Filter. + * @param qry Query. * @return Cursor. + * @see QueryScan + * @see QuerySql + * @see QueryText + * @see QuerySpi */ - public QueryCursor<Entry<K, V>> query(QueryPredicate filter); + public QueryCursor<Entry<K, V>> query(Query qry); /** - * Queries separate entry fields with given SQL predicate. + * Queries separate entry fields. * - * @param filter SQL Filter. + * @param qry SQL Query. * @return Cursor. */ - public QueryCursor<List<?>> queryFields(QuerySqlPredicate filter); + public QueryCursor<List<?>> queryFields(QuerySql qry); /** - * Queries cache with given predicate only locally. + * Queries cache locally. Accepts any subclass of {@link Query}. * - * @param filter Filter. + * @param qry Query. * @return Cursor. + * @see QueryScan + * @see QuerySql + * @see QueryText + * @see QuerySpi */ - public QueryCursor<Entry<K, V>> localQuery(QueryPredicate filter); + public QueryCursor<Entry<K, V>> localQuery(Query qry); /** - * Queries separate entry fields with given SQL predicate only locally. + * Queries separate entry fields locally. * - * @param filter Filter. + * @param qry SQL Query. * @return Cursor. */ - public QueryCursor<List<?>> localQueryFields(QuerySqlPredicate filter); + public QueryCursor<List<?>> localQueryFields(QuerySql qry); /** * Allows for iteration over local cache entries. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java b/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java new file mode 100644 index 0000000..1e70fc8 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java @@ -0,0 +1,140 @@ +/* + * 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.cache.query; + +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.spi.indexing.*; + +import java.io.*; + +/** + * Query to pass into any of {@code Cache.query(...)} methods. + * Use {@link QuerySql} and {@link QueryText} for SQL and + * text queries accordingly. + */ +public abstract class Query<T extends Query> implements Serializable { + /** Page size. */ + private int pageSize; + + /** + * Empty constructor. + */ + Query() { + // No-op. + } + + /** + * Factory method for SQL queries. + * + * @param sql SQL Query string. + * @return SQL Query instance. + */ + public static QuerySql sql(String sql) { + return new QuerySql(sql); + } + + /** + * Factory method for SQL queries. + * + * @param type Type to be queried. + * @param sql SQL Query string. + * @return SQL Query instance. + */ + public static QuerySql sql(Class<?> type, String sql) { + return sql(sql).setType(type); + } + + /** + * Factory method for Lucene fulltext queries. + * + * @param txt Search string. + * @return Fulltext query. + */ + public static QueryText text(String txt) { + return new QueryText(txt); + } + + /** + * Factory method for Lucene fulltext queries. + * + * @param type Type to be queried. + * @param txt Search string. + * @return Fulltext query. + */ + public static QueryText text(Class<?> type, String txt) { + return text(txt).setType(type); + } + + /** + * Factory method for SPI queries. + * + * @param filter Filter. + * @return SPI Query. + */ + public static <K, V> QueryScan<K, V> scan(final IgniteBiPredicate<K, V> filter) { + return new QueryScan<>(filter); + } + + /** + * Factory method for SPI queries returning all entries. + * + * @return SPI Query. + */ + public static <K, V> QueryScan<K, V> scan() { + return new QueryScan<>(); + } + + /** + * Factory method for SPI queries. + * + * @return SPI Query. + * @see IndexingSpi + */ + public static QuerySpi spi() { + return new QuerySpi(); + } + + /** + * Gets optional page size, if {@code 0}, then {@link CacheQueryConfiguration#getPageSize()} is used. + * + * @return Optional page size. + */ + public int getPageSize() { + return pageSize; + } + + /** + * Sets optional page size, if {@code 0}, then {@link CacheQueryConfiguration#getPageSize()} is used. + * + * @param pageSize Optional page size. + * @return {@code this} For chaining. + */ + @SuppressWarnings("unchecked") + public T setPageSize(int pageSize) { + this.pageSize = pageSize; + + return (T)this; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(Query.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuous.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuous.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuous.java new file mode 100644 index 0000000..14138a1 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuous.java @@ -0,0 +1,205 @@ +/* + * 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.cache.query; + +import org.apache.ignite.*; + +import javax.cache.event.*; + +/** + * API for configuring and executing continuous cache queries. + * <p> + * Continuous queries are executed as follows: + * <ol> + * <li> + * Query is sent to requested grid nodes. Note that for {@link org.apache.ignite.cache.CacheMode#LOCAL LOCAL} + * and {@link org.apache.ignite.cache.CacheMode#REPLICATED REPLICATED} caches query will be always executed + * locally. + * </li> + * <li> + * Each node iterates through existing cache data and registers listeners that will + * notify about further updates. + * <li> + * Each key-value pair is passed through optional filter and if this filter returns + * true, key-value pair is sent to the master node (the one that executed query). + * If filter is not provided, all pairs are sent. + * </li> + * <li> + * When master node receives key-value pairs, it notifies the local callback. + * </li> + * </ol> + * <h2 class="header">NOTE</h2> + * Under some concurrent circumstances callback may get several notifications + * for one cache update. This should be taken into account when implementing callback. + * <h1 class="header">Query usage</h1> + * As an example, suppose we have cache with {@code 'Person'} objects and we need + * to query all persons with salary above 1000. + * <p> + * Here is the {@code Person} class: + * <pre name="code" class="java"> + * public class Person { + * // Name. + * private String name; + * + * // Salary. + * private double salary; + * + * ... + * } + * </pre> + * <p> + * You can create and execute continuous query like so: + * <pre name="code" class="java"> + * // Create new continuous query. + * qry = cache.createContinuousQuery(); + * + * // Callback that is called locally when update notifications are received. + * // It simply prints out information about all created persons. + * qry.callback(new GridPredicate2<UUID, Collection<Map.Entry<UUID, Person>>>() { + * @Override public boolean apply(UUID uuid, Collection<Map.Entry<UUID, Person>> entries) { + * for (Map.Entry<UUID, Person> e : entries) { + * Person p = e.getValue(); + * + * X.println(">>>"); + * X.println(">>> " + p.getFirstName() + " " + p.getLastName() + + * "'s salary is " + p.getSalary()); + * X.println(">>>"); + * } + * + * return true; + * } + * }); + * + * // This query will return persons with salary above 1000. + * qry.filter(new GridPredicate2<UUID, Person>() { + * @Override public boolean apply(UUID uuid, Person person) { + * return person.getSalary() > 1000; + * } + * }); + * + * // Execute query. + * qry.execute(); + * </pre> + * This will execute query on all nodes that have cache you are working with and notify callback + * with both data that already exists in cache and further updates. + * <p> + * To stop receiving updates call {@link #close()} method: + * <pre name="code" class="java"> + * qry.cancel(); + * </pre> + * Note that one query instance can be executed only once. After it's cancelled, it's non-operational. + * If you need to repeat execution, use {@link org.apache.ignite.internal.processors.cache.query.CacheQueries#createContinuousQuery()} method to create + * new query. + */ +public final class QueryContinuous<K, V> extends Query implements AutoCloseable { + /** + * Default buffer size. Size of {@code 1} means that all entries + * will be sent to master node immediately (buffering is disabled). + */ + public static final int DFLT_BUF_SIZE = 1; + + /** Maximum default time interval after which buffer will be flushed (if buffering is enabled). */ + public static final long DFLT_TIME_INTERVAL = 0; + + /** + * Default value for automatic unsubscription flag. Remote filters + * will be unregistered by default if master node leaves topology. + */ + public static final boolean DFLT_AUTO_UNSUBSCRIBE = true; + + public void setInitialPredicate(Query filter) { + // TODO: implement. + } + + /** + * Sets local callback. This callback is called only in local node when new updates are received. + * <p> The callback predicate accepts ID of the node from where updates are received and collection + * of received entries. Note that for removed entries value will be {@code null}. + * <p> + * If the predicate returns {@code false}, query execution will be cancelled. + * <p> + * <b>WARNING:</b> all operations that involve any kind of JVM-local or distributed locking (e.g., + * synchronization or transactional cache operations), should be executed asynchronously without + * blocking the thread that called the callback. Otherwise, you can get deadlocks. + * + * @param locLsnr Local callback. + */ + public void setLocalListener(CacheEntryUpdatedListener<K, V> locLsnr) { + // TODO: implement. + } + + /** + * Sets optional key-value filter. This filter is called before entry is sent to the master node. + * <p> + * <b>WARNING:</b> all operations that involve any kind of JVM-local or distributed locking + * (e.g., synchronization or transactional cache operations), should be executed asynchronously + * without blocking the thread that called the filter. Otherwise, you can get deadlocks. + * + * @param filter Key-value filter. + */ + public void setRemoteFilter(CacheEntryEventFilter<K, V> filter) { + // TODO: implement. + } + + /** + * Sets buffer size. <p> When a cache update happens, entry is first put into a buffer. Entries from buffer will be + * sent to the master node only if the buffer is full or time provided via {@link #timeInterval(long)} method is + * exceeded. <p> Default buffer size is {@code 1} which means that entries will be sent immediately (buffering is + * disabled). + * + * @param bufSize Buffer size. + */ + public void bufferSize(int bufSize) { + // TODO: implement. + } + + /** + * Sets time interval. <p> When a cache update happens, entry is first put into a buffer. Entries from buffer will + * be sent to the master node only if the buffer is full (its size can be provided via {@link #bufferSize(int)} + * method) or time provided via this method is exceeded. <p> Default time interval is {@code 0} which means that + * time check is disabled and entries will be sent only when buffer is full. + * + * @param timeInterval Time interval. + */ + public void timeInterval(long timeInterval) { + // TODO: implement. + } + + /** + * Sets automatic unsubscribe flag. <p> This flag indicates that query filters on remote nodes should be + * automatically unregistered if master node (node that initiated the query) leaves topology. If this flag is {@code + * false}, filters will be unregistered only when the query is cancelled from master node, and won't ever be + * unregistered if master node leaves grid. <p> Default value for this flag is {@code true}. + * + * @param autoUnsubscribe Automatic unsubscription flag. + */ + public void autoUnsubscribe(boolean autoUnsubscribe) { + // TODO: implement. + } + + /** + * Stops continuous query execution. <p> Note that one query instance can be executed only once. After it's + * cancelled, it's non-operational. If you need to repeat execution, use {@link + * org.apache.ignite.internal.processors.cache.query.CacheQueries#createContinuousQuery()} method to create new query. + * + * @throws IgniteCheckedException In case of error. + */ + @Override public void close() throws IgniteCheckedException { + // TODO: implement. + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuousPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuousPredicate.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuousPredicate.java deleted file mode 100644 index 070fe2d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryContinuousPredicate.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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.cache.query; - -import org.apache.ignite.*; - -import javax.cache.event.*; - -/** - * API for configuring and executing continuous cache queries. - * <p> - * Continuous queries are executed as follows: - * <ol> - * <li> - * Query is sent to requested grid nodes. Note that for {@link org.apache.ignite.cache.CacheMode#LOCAL LOCAL} - * and {@link org.apache.ignite.cache.CacheMode#REPLICATED REPLICATED} caches query will be always executed - * locally. - * </li> - * <li> - * Each node iterates through existing cache data and registers listeners that will - * notify about further updates. - * <li> - * Each key-value pair is passed through optional filter and if this filter returns - * true, key-value pair is sent to the master node (the one that executed query). - * If filter is not provided, all pairs are sent. - * </li> - * <li> - * When master node receives key-value pairs, it notifies the local callback. - * </li> - * </ol> - * <h2 class="header">NOTE</h2> - * Under some concurrent circumstances callback may get several notifications - * for one cache update. This should be taken into account when implementing callback. - * <h1 class="header">Query usage</h1> - * As an example, suppose we have cache with {@code 'Person'} objects and we need - * to query all persons with salary above 1000. - * <p> - * Here is the {@code Person} class: - * <pre name="code" class="java"> - * public class Person { - * // Name. - * private String name; - * - * // Salary. - * private double salary; - * - * ... - * } - * </pre> - * <p> - * You can create and execute continuous query like so: - * <pre name="code" class="java"> - * // Create new continuous query. - * qry = cache.createContinuousQuery(); - * - * // Callback that is called locally when update notifications are received. - * // It simply prints out information about all created persons. - * qry.callback(new GridPredicate2<UUID, Collection<Map.Entry<UUID, Person>>>() { - * @Override public boolean apply(UUID uuid, Collection<Map.Entry<UUID, Person>> entries) { - * for (Map.Entry<UUID, Person> e : entries) { - * Person p = e.getValue(); - * - * X.println(">>>"); - * X.println(">>> " + p.getFirstName() + " " + p.getLastName() + - * "'s salary is " + p.getSalary()); - * X.println(">>>"); - * } - * - * return true; - * } - * }); - * - * // This query will return persons with salary above 1000. - * qry.filter(new GridPredicate2<UUID, Person>() { - * @Override public boolean apply(UUID uuid, Person person) { - * return person.getSalary() > 1000; - * } - * }); - * - * // Execute query. - * qry.execute(); - * </pre> - * This will execute query on all nodes that have cache you are working with and notify callback - * with both data that already exists in cache and further updates. - * <p> - * To stop receiving updates call {@link #close()} method: - * <pre name="code" class="java"> - * qry.cancel(); - * </pre> - * Note that one query instance can be executed only once. After it's cancelled, it's non-operational. - * If you need to repeat execution, use {@link org.apache.ignite.internal.processors.cache.query.CacheQueries#createContinuousQuery()} method to create - * new query. - */ -public final class QueryContinuousPredicate<K, V> extends QueryPredicate implements AutoCloseable { - /** - * Default buffer size. Size of {@code 1} means that all entries - * will be sent to master node immediately (buffering is disabled). - */ - public static final int DFLT_BUF_SIZE = 1; - - /** Maximum default time interval after which buffer will be flushed (if buffering is enabled). */ - public static final long DFLT_TIME_INTERVAL = 0; - - /** - * Default value for automatic unsubscription flag. Remote filters - * will be unregistered by default if master node leaves topology. - */ - public static final boolean DFLT_AUTO_UNSUBSCRIBE = true; - - public void setInitialPredicate(QueryPredicate filter) { - // TODO: implement. - } - - /** - * Sets local callback. This callback is called only in local node when new updates are received. - * <p> The callback predicate accepts ID of the node from where updates are received and collection - * of received entries. Note that for removed entries value will be {@code null}. - * <p> - * If the predicate returns {@code false}, query execution will be cancelled. - * <p> - * <b>WARNING:</b> all operations that involve any kind of JVM-local or distributed locking (e.g., - * synchronization or transactional cache operations), should be executed asynchronously without - * blocking the thread that called the callback. Otherwise, you can get deadlocks. - * - * @param locLsnr Local callback. - */ - public void setLocalListener(CacheEntryUpdatedListener<K, V> locLsnr) { - // TODO: implement. - } - - /** - * Sets optional key-value filter. This filter is called before entry is sent to the master node. - * <p> - * <b>WARNING:</b> all operations that involve any kind of JVM-local or distributed locking - * (e.g., synchronization or transactional cache operations), should be executed asynchronously - * without blocking the thread that called the filter. Otherwise, you can get deadlocks. - * - * @param filter Key-value filter. - */ - public void setRemoteFilter(CacheEntryEventFilter<K, V> filter) { - // TODO: implement. - } - - /** - * Sets buffer size. <p> When a cache update happens, entry is first put into a buffer. Entries from buffer will be - * sent to the master node only if the buffer is full or time provided via {@link #timeInterval(long)} method is - * exceeded. <p> Default buffer size is {@code 1} which means that entries will be sent immediately (buffering is - * disabled). - * - * @param bufSize Buffer size. - */ - public void bufferSize(int bufSize) { - // TODO: implement. - } - - /** - * Sets time interval. <p> When a cache update happens, entry is first put into a buffer. Entries from buffer will - * be sent to the master node only if the buffer is full (its size can be provided via {@link #bufferSize(int)} - * method) or time provided via this method is exceeded. <p> Default time interval is {@code 0} which means that - * time check is disabled and entries will be sent only when buffer is full. - * - * @param timeInterval Time interval. - */ - public void timeInterval(long timeInterval) { - // TODO: implement. - } - - /** - * Sets automatic unsubscribe flag. <p> This flag indicates that query filters on remote nodes should be - * automatically unregistered if master node (node that initiated the query) leaves topology. If this flag is {@code - * false}, filters will be unregistered only when the query is cancelled from master node, and won't ever be - * unregistered if master node leaves grid. <p> Default value for this flag is {@code true}. - * - * @param autoUnsubscribe Automatic unsubscription flag. - */ - public void autoUnsubscribe(boolean autoUnsubscribe) { - // TODO: implement. - } - - /** - * Stops continuous query execution. <p> Note that one query instance can be executed only once. After it's - * cancelled, it's non-operational. If you need to repeat execution, use {@link - * org.apache.ignite.internal.processors.cache.query.CacheQueries#createContinuousQuery()} method to create new query. - * - * @throws IgniteCheckedException In case of error. - */ - @Override public void close() throws IgniteCheckedException { - // TODO: implement. - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryPredicate.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryPredicate.java deleted file mode 100644 index f02a1f8..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryPredicate.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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.cache.query; - -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.spi.indexing.*; - -import java.io.*; - -/** - * Query to pass into any of {@code Cache.query(...)} methods. - * Use {@link QuerySqlPredicate} and {@link QueryTextPredicate} for SQL and - * text queries accordingly. - */ -public abstract class QueryPredicate<T extends QueryPredicate> implements Serializable { - /** Page size. */ - private int pageSize; - - /** - * Empty constructor. - */ - protected QueryPredicate() { - // No-op. - } - - /** - * Factory method for SQL queries. - * - * @param sql SQL Query string. - * @return SQL Query instance. - */ - public static QuerySqlPredicate sql(String sql) { - return new QuerySqlPredicate(sql); - } - - /** - * Factory method for SQL queries. - * - * @param type Type to be queried. - * @param sql SQL Query string. - * @return SQL Query instance. - */ - public static QuerySqlPredicate sql(Class<?> type, String sql) { - return sql(sql).setType(type); - } - - /** - * Factory method for Lucene fulltext queries. - * - * @param txt Search string. - * @return Fulltext query. - */ - public static QueryTextPredicate text(String txt) { - return new QueryTextPredicate(txt); - } - - /** - * Factory method for Lucene fulltext queries. - * - * @param type Type to be queried. - * @param txt Search string. - * @return Fulltext query. - */ - public static QueryTextPredicate text(Class<?> type, String txt) { - return text(txt).setType(type); - } - - /** - * Factory method for SPI queries. - * - * @param filter Filter. - * @return SPI Query. - */ - public static <K, V> QueryScanPredicate<K, V> scan(final IgniteBiPredicate<K, V> filter) { - return new QueryScanPredicate<>(filter); - } - - /** - * Factory method for SPI queries returning all entries. - * - * @return SPI Query. - */ - public static <K, V> QueryScanPredicate<K, V> scan() { - return new QueryScanPredicate<>(); - } - - /** - * Factory method for SPI queries. - * - * @return SPI Query. - * @see IndexingSpi - */ - public static QuerySpiPredicate spi() { - return new QuerySpiPredicate(); - } - - /** - * Gets optional page size, if {@code 0}, then {@link CacheQueryConfiguration#getPageSize()} is used. - * - * @return Optional page size. - */ - public int getPageSize() { - return pageSize; - } - - /** - * Sets optional page size, if {@code 0}, then {@link CacheQueryConfiguration#getPageSize()} is used. - * - * @param pageSize Optional page size. - * @return {@code this} For chaining. - */ - @SuppressWarnings("unchecked") - public T setPageSize(int pageSize) { - this.pageSize = pageSize; - - return (T)this; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(QueryPredicate.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScan.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScan.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScan.java new file mode 100644 index 0000000..35b6299 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScan.java @@ -0,0 +1,69 @@ +/* + * 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.cache.query; + +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.lang.*; + +/** + * Scan query over cache entries. Will accept all the entries if no predicate was set. + */ +public class QueryScan<K, V> extends Query<QueryScan<K, V>> { + /** */ + private IgniteBiPredicate<K,V> filter; + + /** + * Create scan query returning all entries. + */ + public QueryScan() { + this(new IgniteBiPredicate<K,V>() { + @Override public boolean apply(K k, V v) { + return true; + } + }); + } + + /** + * Create scan query with filter. + * + * @param filter Filter. + */ + public QueryScan(IgniteBiPredicate<K,V> filter) { + setFilter(filter); + } + + /** + * Gets filter. + * + * @return Filter. + */ + public IgniteBiPredicate<K,V> getFilter() { + return filter; + } + + /** + * Sets filter. + * + * @param filter Filter. + */ + public void setFilter(IgniteBiPredicate<K,V> filter) { + A.notNull(filter, "filter"); + + this.filter = filter; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScanPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScanPredicate.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScanPredicate.java deleted file mode 100644 index bcb686c..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryScanPredicate.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.cache.query; - -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; - -/** - * Scan query over cache entries. By default will accept all the entries. - */ -public class QueryScanPredicate<K, V> extends QueryPredicate<QueryScanPredicate<K, V>> { - /** */ - private IgniteBiPredicate<K,V> filter; - - /** - * Create scan query returning all entries. - */ - public QueryScanPredicate() { - this(new IgniteBiPredicate<K,V>() { - @Override public boolean apply(K k, V v) { - return true; - } - }); - } - - /** - * Create scan query with filter. - * - * @param filter Filter. - */ - public QueryScanPredicate(IgniteBiPredicate<K,V> filter) { - setFilter(filter); - } - - /** - * Gets filter. - * - * @return Filter. - */ - public IgniteBiPredicate<K,V> getFilter() { - return filter; - } - - /** - * Sets filter. - * - * @param filter Filter. - */ - public void setFilter(IgniteBiPredicate<K,V> filter) { - A.notNull(filter, "filter"); - - this.filter = filter; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpi.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpi.java new file mode 100644 index 0000000..d46f634 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpi.java @@ -0,0 +1,49 @@ +/* + * 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.cache.query; + +import org.apache.ignite.spi.indexing.*; + +/** + * Query to be used by {@link IndexingSpi} implementations. + */ +public final class QuerySpi extends Query<QuerySpi> { + /** Arguments. */ + private Object[] args; + + /** + * Gets SQL arguments. + * + * @return SQL arguments. + */ + public Object[] getArgs() { + return args; + } + + /** + * Sets SQL arguments. + * + * @param args SQL arguments. + * @return {@code this} For chaining. + */ + public QuerySpi setArgs(Object... args) { + this.args = args; + + return this; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpiPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpiPredicate.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpiPredicate.java deleted file mode 100644 index 0baf313..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpiPredicate.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.cache.query; - -import org.apache.ignite.spi.indexing.*; - -/** - * Query to be used by {@link IndexingSpi} implementations. - */ -public final class QuerySpiPredicate extends QueryPredicate<QuerySpiPredicate> { - /** Arguments. */ - private Object[] args; - - /** - * Gets SQL arguments. - * - * @return SQL arguments. - */ - public Object[] getArgs() { - return args; - } - - /** - * Sets SQL arguments. - * - * @param args SQL arguments. - * @return {@code this} For chaining. - */ - public QuerySpiPredicate setArgs(Object... args) { - this.args = args; - - return this; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySql.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySql.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySql.java new file mode 100644 index 0000000..a8c8883 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySql.java @@ -0,0 +1,150 @@ +/* + * 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.cache.query; + +import org.apache.ignite.internal.util.tostring.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +/** + * SQL Query to use with any of the {@code JCache.query(...)} and + * {@code JCache.queryFields(...)} methods. + */ +public final class QuerySql extends Query<QuerySql> { + /** */ + private String type; + + /** SQL clause. */ + private String sql; + + /** Arguments. */ + @GridToStringInclude + private Object[] args; + + /** + * Constructs query for the given SQL query. + * + * @param sql SQL Query. + */ + public QuerySql(String sql) { + setSql(sql); + } + + /** + * Constructs query for the given type and SQL query. + * + * @param type Type. + * @param sql SQL Query. + */ + public QuerySql(Class<?> type, String sql) { + this(sql); + + setType(type); + } + + /** + * Gets SQL clause. + * + * @return SQL clause. + */ + public String getSql() { + return sql; + } + + /** + * Sets SQL clause. + * + * @param sql SQL clause. + * @return {@code this} For chaining. + */ + public QuerySql setSql(String sql) { + A.notNull(sql, "sql"); + + this.sql = sql; + + return this; + } + + /** + * Gets SQL arguments. + * + * @return SQL arguments. + */ + public Object[] getArgs() { + return args; + } + + /** + * Sets SQL arguments. + * + * @param args SQL arguments. + * @return {@code this} For chaining. + */ + public QuerySql setArgs(Object... args) { + this.args = args; + + return this; + } + + /** + * Gets type for query. + * + * @return Type. + */ + public String getType() { + return type; + } + + /** + * Sets type for query. + * + * @param type Type. + * @return {@code this} For chaining. + */ + public QuerySql setType(String type) { + this.type = type; + + return this; + } + + /** + * @param type Type. + */ + public QuerySql setType(Class<?> type) { + return setType(name(type)); + } + + /** + * @param type Type class. + * @return Type name. + */ + static String name(Class<?> type) { + if (type == null) + return null; + + String name = type.getName(); + + int dot = name.lastIndexOf('.'); + + return dot == -1 ? name : name.substring(dot + 1); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(QuerySql.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySqlPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySqlPredicate.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySqlPredicate.java deleted file mode 100644 index 30f3ebf..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/QuerySqlPredicate.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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.cache.query; - -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -/** - * Query SQL predicate to use with any of the {@code JCache.query(...)} and - * {@code JCache.queryFields(...)} methods. - */ -public final class QuerySqlPredicate extends QueryPredicate<QuerySqlPredicate> { - /** */ - private String type; - - /** SQL clause. */ - private String sql; - - /** Arguments. */ - @GridToStringInclude - private Object[] args; - - /** - * Constructs query for the given SQL query. - * - * @param sql SQL Query. - */ - public QuerySqlPredicate(String sql) { - setSql(sql); - } - - /** - * Constructs query for the given type and SQL query. - * - * @param type Type. - * @param sql SQL Query. - */ - public QuerySqlPredicate(Class<?> type, String sql) { - this(sql); - - setType(type); - } - - /** - * Gets SQL clause. - * - * @return SQL clause. - */ - public String getSql() { - return sql; - } - - /** - * Sets SQL clause. - * - * @param sql SQL clause. - * @return {@code this} For chaining. - */ - public QuerySqlPredicate setSql(String sql) { - A.notNull(sql, "sql"); - - this.sql = sql; - - return this; - } - - /** - * Gets SQL arguments. - * - * @return SQL arguments. - */ - public Object[] getArgs() { - return args; - } - - /** - * Sets SQL arguments. - * - * @param args SQL arguments. - * @return {@code this} For chaining. - */ - public QuerySqlPredicate setArgs(Object... args) { - this.args = args; - - return this; - } - - /** - * Gets type for query. - * - * @return Type. - */ - public String getType() { - return type; - } - - /** - * Sets type for query. - * - * @param type Type. - * @return {@code this} For chaining. - */ - public QuerySqlPredicate setType(String type) { - this.type = type; - - return this; - } - - /** - * @param type Type. - */ - public QuerySqlPredicate setType(Class<?> type) { - return setType(name(type)); - } - - /** - * @param type Type class. - * @return Type name. - */ - static String name(Class<?> type) { - if (type == null) - return null; - - String name = type.getName(); - - int dot = name.lastIndexOf('.'); - - return dot == -1 ? name : name.substring(dot + 1); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(QuerySqlPredicate.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryText.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryText.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryText.java new file mode 100644 index 0000000..7c3aa13 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryText.java @@ -0,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.cache.query; + +import org.apache.ignite.internal.util.typedef.internal.*; + +import static org.apache.ignite.cache.query.QuerySql.*; + +/** + * Query for Lucene based fulltext search. + */ +public final class QueryText extends Query<QueryText> { + /** */ + private String type; + + /** SQL clause. */ + private String txt; + + /** + * Constructs query for the given search string. + * + * @param txt Search string. + */ + public QueryText(String txt) { + setText(txt); + } + + /** + * Constructs query for the given search string. + * + * @param type Type. + * @param txt Search string. + */ + public QueryText(Class<?> type, String txt) { + this(txt); + + setType(type); + } + + /** + * Gets type for query. + * + * @return Type. + */ + public String getType() { + return type; + } + + /** + * Sets type for query. + * + * @param type Type. + * @return {@code this} For chaining. + */ + public QueryText setType(Class<?> type) { + return setType(name(type)); + } + + /** + * Sets type for query. + * + * @param type Type. + * @return {@code this} For chaining. + */ + public QueryText setType(String type) { + this.type = type; + + return this; + } + + /** + * Gets text search string. + * + * @return Text search string. + */ + public String getText() { + return txt; + } + + /** + * Sets text search string. + * + * @param txt Text search string. + * @return {@code this} For chaining. + */ + public QueryText setText(String txt) { + A.notNull(txt, "txt"); + + this.txt = txt; + + return this; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(QueryText.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryTextPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryTextPredicate.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryTextPredicate.java deleted file mode 100644 index d58625b..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryTextPredicate.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.cache.query; - -import org.apache.ignite.internal.util.typedef.internal.*; - -import static org.apache.ignite.cache.query.QuerySqlPredicate.name; - -/** - * Predicate for Lucene based fulltext search. - */ -public final class QueryTextPredicate extends QueryPredicate<QueryTextPredicate> { - /** */ - private String type; - - /** SQL clause. */ - private String txt; - - /** - * Constructs query for the given search string. - * - * @param txt Search string. - */ - public QueryTextPredicate(String txt) { - setText(txt); - } - - /** - * Constructs query for the given search string. - * - * @param type Type. - * @param txt Search string. - */ - public QueryTextPredicate(Class<?> type, String txt) { - this(txt); - - setType(type); - } - - /** - * Gets type for query. - * - * @return Type. - */ - public String getType() { - return type; - } - - /** - * Sets type for query. - * - * @param type Type. - * @return {@code this} For chaining. - */ - public QueryTextPredicate setType(Class<?> type) { - return setType(name(type)); - } - - /** - * Sets type for query. - * - * @param type Type. - * @return {@code this} For chaining. - */ - public QueryTextPredicate setType(String type) { - this.type = type; - - return this; - } - - /** - * Gets text search string. - * - * @return Text search string. - */ - public String getText() { - return txt; - } - - /** - * Sets text search string. - * - * @param txt Text search string. - * @return {@code this} For chaining. - */ - public QueryTextPredicate setText(String txt) { - A.notNull(txt, "txt"); - - this.txt = txt; - - return this; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(QueryTextPredicate.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git 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 index 7f83ec3..670421d 100644 --- 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 @@ -249,11 +249,11 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V * @return Cursor. */ @SuppressWarnings("unchecked") - private QueryCursor<Entry<K,V>> query(QueryPredicate filter, @Nullable ClusterGroup grp) { + private QueryCursor<Entry<K,V>> query(Query filter, @Nullable ClusterGroup grp) { final CacheQuery<Map.Entry<K,V>> qry; final CacheQueryFuture<Map.Entry<K,V>> fut; - if (filter instanceof QueryScanPredicate) { + if (filter instanceof QueryScan) { qry = delegate.queries().createScanQuery((IgniteBiPredicate<K,V>)filter); if (grp != null) @@ -261,8 +261,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V fut = qry.execute(); } - else if (filter instanceof QueryTextPredicate) { - QueryTextPredicate p = (QueryTextPredicate)filter; + else if (filter instanceof QueryText) { + QueryText p = (QueryText)filter; qry = delegate.queries().createFullTextQuery(p.getType(), p.getText()); @@ -271,13 +271,13 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V fut = qry.execute(); } - else if (filter instanceof QuerySpiPredicate) { + else if (filter instanceof QuerySpi) { qry = ((GridCacheQueriesEx)delegate.queries()).createSpiQuery(); if (grp != null) qry.projection(grp); - fut = qry.execute(((QuerySpiPredicate)filter).getArgs()); + fut = qry.execute(((QuerySpi)filter).getArgs()); } else throw new IgniteException("Unsupported query predicate: " + filter); @@ -308,14 +308,14 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** {@inheritDoc} */ - @Override public QueryCursor<Entry<K,V>> query(QueryPredicate filter) { + @Override public QueryCursor<Entry<K,V>> query(Query filter) { A.notNull(filter, "filter"); GridCacheProjectionImpl<K, V> prev = gate.enter(prj); try { - if (filter instanceof QuerySqlPredicate) { - QuerySqlPredicate p = (QuerySqlPredicate)filter; + if (filter instanceof QuerySql) { + QuerySql p = (QuerySql)filter; return ctx.kernalContext().query().queryTwoStep(ctx.name(), p.getType(), p.getSql(), p.getArgs()); } @@ -334,7 +334,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** {@inheritDoc} */ - @Override public QueryCursor<List<?>> queryFields(QuerySqlPredicate filter) { + @Override public QueryCursor<List<?>> queryFields(QuerySql filter) { A.notNull(filter, "filter"); GridCacheProjectionImpl<K, V> prev = gate.enter(prj); @@ -354,14 +354,14 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** {@inheritDoc} */ - @Override public QueryCursor<Entry<K,V>> localQuery(QueryPredicate filter) { + @Override public QueryCursor<Entry<K,V>> localQuery(Query filter) { A.notNull(filter, "filter"); GridCacheProjectionImpl<K, V> prev = gate.enter(prj); try { - if (filter instanceof QuerySqlPredicate) { - QuerySqlPredicate p = (QuerySqlPredicate)filter; + if (filter instanceof QuerySql) { + QuerySql p = (QuerySql)filter; return new QueryCursorImpl<>(ctx.kernalContext().query().<K,V>queryLocal( ctx.name(), p.getType(), p.getSql(), p.getArgs())); @@ -381,7 +381,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V } /** {@inheritDoc} */ - @Override public QueryCursor<List<?>> localQueryFields(QuerySqlPredicate filter) { + @Override public QueryCursor<List<?>> localQueryFields(QuerySql filter) { A.notNull(filter, "filter"); GridCacheProjectionImpl<K, V> prev = gate.enter(prj); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java ---------------------------------------------------------------------- diff --git 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 index 67bf4ce..e9b0c7e 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 @@ -73,7 +73,7 @@ public class IgniteCacheFieldsQueryNoDataSelfTest extends GridCommonAbstractTest */ public void testQuery() throws Exception { Collection<Cache.Entry<Object, Object>> res = grid().jcache(null) - .query(new QuerySqlPredicate("select _VAL from Integer")).getAll(); + .query(new QuerySql("select _VAL from Integer")).getAll(); assert res != null; assert res.isEmpty(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java index 6c9f0ec..3e8d963 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java @@ -98,7 +98,7 @@ public class IgniteCacheQueryIndexSelfTest extends GridCacheAbstractSelfTest { */ private void checkQuery(IgniteCache<Integer, CacheValue> cache) throws Exception { QueryCursor<Cache.Entry<Integer, CacheValue>> qry = - cache.query(new QuerySqlPredicate("val >= 5")); + cache.query(new QuerySql("val >= 5")); Collection<Cache.Entry<Integer, CacheValue>> queried = qry.getAll(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQueryMultiThreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQueryMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQueryMultiThreadedSelfTest.java index 998cfed..f41ac96 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQueryMultiThreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQueryMultiThreadedSelfTest.java @@ -40,7 +40,7 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.cache.query.QueryPredicate.*; +import static org.apache.ignite.cache.query.Query.*; /** * Tests for partitioned cache queries. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java index b62342c..071cc86 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java @@ -177,7 +177,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testExecute() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select _KEY, name, age from Person")); + .queryFields(new QuerySql("select _KEY, name, age from Person")); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -223,7 +223,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testExecuteWithArguments() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select _KEY, name, age from Person where age > ?").setArgs(30)); + .queryFields(new QuerySql("select _KEY, name, age from Person where age > ?").setArgs(30)); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -264,7 +264,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testSelectAllJoined() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select * from Person p, Organization o where p.orgId = o.id")); + .queryFields(new QuerySql("select * from Person p, Organization o where p.orgId = o.id")); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -326,7 +326,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testEmptyResult() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select name from Person where age = 0")); + .queryFields(new QuerySql("select name from Person where age = 0")); Collection<List<?>> res = qry.getAll(); @@ -336,7 +336,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testQueryString() throws Exception { - QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(new QuerySqlPredicate("select * from String")); + QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(new QuerySql("select * from String")); Collection<List<?>> res = qry.getAll(); @@ -353,7 +353,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testQueryIntegersWithJoin() throws Exception { - QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(new QuerySqlPredicate( + QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(new QuerySql( "select i._KEY, i._VAL, j._KEY, j._VAL from Integer i join Integer j where i._VAL >= 100")); Collection<List<?>> res = qry.getAll(); @@ -379,7 +379,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA public void testPagination() throws Exception { // Query with page size 20. QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select * from Integer").setPageSize(20)); + .queryFields(new QuerySql("select * from Integer").setPageSize(20)); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -404,7 +404,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA for (int i = 0; i < 200; i++) cache.put(i, i); - QueryCursor<List<?>> qry = cache.queryFields(new QuerySqlPredicate("select * from Integer")); + QueryCursor<List<?>> qry = cache.queryFields(new QuerySql("select * from Integer")); Collection<List<?>> res = qry.getAll(); @@ -418,7 +418,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA cache.put("key", "val"); - QueryCursor<List<?>> qry = cache.queryFields(new QuerySqlPredicate("select * from String")); + QueryCursor<List<?>> qry = cache.queryFields(new QuerySql("select * from String")); assert qry.getAll().isEmpty(); @@ -436,7 +436,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA cache.put(key, val); - Collection<List<?>> res = cache.queryFields(new QuerySqlPredicate("select * from Person")).getAll(); + Collection<List<?>> res = cache.queryFields(new QuerySql("select * from Person")).getAll(); assertEquals(1, res.size()); @@ -482,7 +482,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA */ private void testPaginationIterator(@Nullable String cacheName) throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(cacheName) - .queryFields(new QuerySqlPredicate("select _key, _val from Integer").setPageSize(10)); + .queryFields(new QuerySql("select _key, _val from Integer").setPageSize(10)); int cnt = 0; @@ -505,8 +505,8 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA * @param args Arguments. * @return Predicate. */ - private QuerySqlPredicate sqlPage(int pageSize, String sql, Object ... args) { - QuerySqlPredicate q = new QuerySqlPredicate(sql).setArgs(args); + private QuerySql sqlPage(int pageSize, String sql, Object ... args) { + QuerySql q = new QuerySql(sql).setArgs(args); q.setPageSize(pageSize); @@ -516,7 +516,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testPaginationIteratorKeepAll() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select _key, _val from Integer").setPageSize(10)); + .queryFields(new QuerySql("select _key, _val from Integer").setPageSize(10)); int cnt = 0; @@ -568,7 +568,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA */ private void testPaginationGet(@Nullable String cacheName) throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select _key, _val from Integer").setPageSize(10)); + .queryFields(new QuerySql("select _key, _val from Integer").setPageSize(10)); List<List<?>> list = new ArrayList<>(qry.getAll()); @@ -591,7 +591,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testEmptyGrid() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(new QuerySqlPredicate("select name, age from Person where age = 25")); + .queryFields(new QuerySql("select name, age from Person where age = 25")); List<?> res = F.first(qry.getAll()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9e2e5e2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java index add4a22..41e83c1 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java @@ -53,7 +53,7 @@ import static org.apache.ignite.cache.CacheDistributionMode.*; 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.QueryPredicate.*; +import static org.apache.ignite.cache.query.Query.*; import static org.apache.ignite.internal.processors.cache.query.CacheQueryType.*; import static org.apache.ignite.events.EventType.*; import static org.junit.Assert.*; @@ -213,7 +213,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put("tst", "test"); - QueryCursor<Cache.Entry<String, String>> qry = cache.query(new QuerySqlPredicate(String.class, "_val='test'")); + QueryCursor<Cache.Entry<String, String>> qry = cache.query(new QuerySql(String.class, "_val='test'")); Cache.Entry<String, String> entry = F.first(qry.getAll()); @@ -235,7 +235,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(key, val); QueryCursor<Cache.Entry<String, Integer>> qry = - cache.query(new QuerySqlPredicate(Integer.class, "_key = 'k' and _val > 1")); + cache.query(new QuerySql(Integer.class, "_key = 'k' and _val > 1")); Cache.Entry<String, Integer> entry = F.first(qry.getAll()); @@ -253,7 +253,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac // Without alias. final IgniteCache<Object, Object> cache = ignite.jcache(null); - QueryCursor<List<?>> qry = cache.queryFields(new QuerySqlPredicate("select square(1), square(2)")); + QueryCursor<List<?>> qry = cache.queryFields(new QuerySql("select square(1), square(2)")); Collection<List<?>> res = qry.getAll(); @@ -265,7 +265,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac assertEquals(4, row.get(1)); // With alias. - qry = cache.queryFields(new QuerySqlPredicate("select _cube_(1), _cube_(2)")); + qry = cache.queryFields(new QuerySql("select _cube_(1), _cube_(2)")); res = qry.getAll(); @@ -281,7 +281,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac log, new Callable<Object>() { @Override public Object call() throws Exception { - cache.queryFields(new QuerySqlPredicate("select no()")); + cache.queryFields(new QuerySql("select no()")); return null; } @@ -302,7 +302,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac IgniteCache<String, Integer> cache = ignite.jcache(null); - List<Cache.Entry<String, Integer>> qry = cache.query(new QuerySqlPredicate(Integer.class, "1=1")).getAll(); + List<Cache.Entry<String, Integer>> qry = cache.query(new QuerySql(Integer.class, "1=1")).getAll(); Cache.Entry<String, Integer> res = F.first(qry); @@ -324,7 +324,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, 1); cache.put(2, 2); - QueryCursor<Cache.Entry<Integer,Integer>> qry = cache.query(new QuerySqlPredicate(Integer.class, "_key between 2 and 1")); + QueryCursor<Cache.Entry<Integer,Integer>> qry = cache.query(new QuerySql(Integer.class, "_key between 2 and 1")); assertTrue(qry.getAll().isEmpty()); } @@ -354,7 +354,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(new Key(100501), val2); QueryCursor<Cache.Entry<Key, GridCacheQueryTestValue>> qry = cache - .query(new QuerySqlPredicate(GridCacheQueryTestValue.class, + .query(new QuerySql(GridCacheQueryTestValue.class, "fieldName='field1' and field2=1 and field3=1 and id=100500 and embeddedField2=11 and x=3")); Cache.Entry<Key, GridCacheQueryTestValue> entry = F.first(qry.getAll()); @@ -409,7 +409,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put("key", "value"); - QueryCursor<Cache.Entry<String, String>> qry = cache.query(new QuerySqlPredicate(String.class, "true")); + QueryCursor<Cache.Entry<String, String>> qry = cache.query(new QuerySql(String.class, "true")); Iterator<Cache.Entry<String, String>> iter = qry.iterator(); @@ -490,7 +490,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac QueryCursor<Cache.Entry<Integer, ObjectValue>> qry = - cache.query(new QuerySqlPredicate(ObjectValue.class, "intVal >= ? order by intVal").setArgs(0)); + cache.query(new QuerySql(ObjectValue.class, "intVal >= ? order by intVal").setArgs(0)); Iterator<Cache.Entry<Integer, ObjectValue>> iter = qry.iterator(); @@ -517,7 +517,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac for (int i = 0; i < cnt; i++) assert set.contains(i); - qry = cache.query(new QuerySqlPredicate(ObjectValue.class, "MOD(intVal, 2) = ? order by intVal").setArgs(0)); + qry = cache.query(new QuerySql(ObjectValue.class, "MOD(intVal, 2) = ? order by intVal").setArgs(0)); iter = qry.iterator(); @@ -554,11 +554,11 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac // Try to execute on empty cache first. QueryCursor<Cache.Entry<Integer, ObjectValue>> qry = - cache.query(new QueryTextPredicate(ObjectValue.class, "full")); + cache.query(new QueryText(ObjectValue.class, "full")); assert qry.getAll().isEmpty(); - qry = cache.query(new QueryTextPredicate(ObjectValue.class, "full")); + qry = cache.query(new QueryText(ObjectValue.class, "full")); assert qry.getAll().isEmpty(); @@ -575,7 +575,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(key2, val2); - qry = cache.query(new QueryTextPredicate(ObjectValue.class, "full")); + qry = cache.query(new QueryText(ObjectValue.class, "full")); Collection<Cache.Entry<Integer, ObjectValue>> res = qry.getAll(); @@ -583,7 +583,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac assert res.size() == 2; - qry = cache.query(new QueryTextPredicate(ObjectValue.class, "full")); + qry = cache.query(new QueryText(ObjectValue.class, "full")); res = qry.getAll(); @@ -638,7 +638,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac c1.put("key", "value"); // Scan query. - QueryCursor<Cache.Entry<String, String>> qry = c1.query(new QueryScanPredicate<String, String>()); + QueryCursor<Cache.Entry<String, String>> qry = c1.query(new QueryScan<String, String>()); Iterator<Cache.Entry<String, String>> iter = qry.iterator(); @@ -667,14 +667,14 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac c.put(1, new ObjectValue("ObjectValue str", 1)); c.put("key", new ObjectValueOther("ObjectValueOther str")); - Collection<Cache.Entry<Object, Object>> res = c.query(new QueryTextPredicate(ObjectValue.class, "str")).getAll(); + Collection<Cache.Entry<Object, Object>> res = c.query(new QueryText(ObjectValue.class, "str")).getAll(); assert res != null; int expCnt = 1; assert res.size() == expCnt; assert F.first(res).getValue().getClass() == ObjectValue.class; - res = c.query(new QueryTextPredicate(ObjectValueOther.class, "str")).getAll(); + res = c.query(new QueryText(ObjectValueOther.class, "str")).getAll(); assert res != null; assert res.size() == expCnt; @@ -706,7 +706,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, 1); cache.put(2, 2); - QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(new QuerySqlPredicate(Integer.class, "_val > 1")); + QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(new QuerySql(Integer.class, "_val > 1")); Collection<Cache.Entry<Integer, Integer>> res = q.getAll(); @@ -742,7 +742,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac for (int i = 0; i < 50; i++) cache.put(i, i); - QuerySqlPredicate qry = new QuerySqlPredicate(Integer.class, "_key >= 0"); + QuerySql qry = new QuerySql(Integer.class, "_key >= 0"); qry.setPageSize(10); @@ -785,7 +785,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(new QuerySqlPredicate(Integer.class, "_key >= 0")); + cache.query(new QuerySql(Integer.class, "_key >= 0")); List<Cache.Entry<Integer, Integer>> list = new ArrayList<>(q.getAll()); @@ -851,7 +851,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(key, val); - QueryCursor<Cache.Entry<String, Integer>> qry = cache.query(new QuerySqlPredicate(Integer.class, + QueryCursor<Cache.Entry<String, Integer>> qry = cache.query(new QuerySql(Integer.class, "_key = 'k' and _val > 1")); Cache.Entry<String, Integer> entry = F.first(qry.getAll()); @@ -871,7 +871,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(new BadHashKeyObject("test_key0"), 1005001); cache.put(new BadHashKeyObject("test_key1"), 7); - assertEquals(1005001, cache.query(new QuerySqlPredicate(Integer.class, "_key = ?").setArgs( + assertEquals(1005001, cache.query(new QuerySql(Integer.class, "_key = ?").setArgs( new BadHashKeyObject("test_key0"))).iterator().next().getValue().intValue()); } @@ -886,7 +886,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(new ObjectValue("test_key1", 12), 17); assertEquals(11005, - cache.query(new QueryTextPredicate(Integer.class, "test_key0")) + cache.query(new QueryText(Integer.class, "test_key0")) .iterator().next().getValue().intValue()); } @@ -909,13 +909,13 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, val); - QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(new QuerySqlPredicate(val.getClass(), "_key >= 0")); + QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(new QuerySql(val.getClass(), "_key >= 0")); Collection<Cache.Entry<Integer, Object>> res = q.getAll(); assertEquals(1, res.size()); - List<List<?>> fieldsRes = cache.queryFields(new QuerySqlPredicate( + List<List<?>> fieldsRes = cache.queryFields(new QuerySql( "select field1 from IgniteCacheAbstractQuerySelfTest_5")).getAll(); assertEquals(1, fieldsRes.size()); @@ -947,7 +947,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, val1); cache.put(2, val2); - QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(new QuerySqlPredicate(val1.getClass(), "_key >= 0")); + QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(new QuerySql(val1.getClass(), "_key >= 0")); Collection<Cache.Entry<Integer, Object>> res = q.getAll(); @@ -964,7 +964,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(new QuerySqlPredicate(Integer.class, "_key >= 0")); + cache.query(new QuerySql(Integer.class, "_key >= 0")); Collection<Cache.Entry<Integer, Integer>> res = q.getAll(); @@ -994,7 +994,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(new QuerySqlPredicate(Integer.class, "limit 5")); + cache.query(new QuerySql(Integer.class, "limit 5")); Collection<Cache.Entry<Integer, Integer>> res = q.getAll(); @@ -1022,7 +1022,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(2, new ArrayObject(new Long[] {4L, 5L, 6L})); QueryCursor<Cache.Entry<Integer, ArrayObject>> q = - cache.query(new QuerySqlPredicate(ArrayObject.class, "array_contains(arr, cast(4 as long))")); + cache.query(new QuerySql(ArrayObject.class, "array_contains(arr, cast(4 as long))")); Collection<Cache.Entry<Integer, ArrayObject>> res = q.getAll(); @@ -1106,7 +1106,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(new QuerySqlPredicate(Integer.class, "_key >= ?").setArgs(10)); + cache.query(new QuerySql(Integer.class, "_key >= ?").setArgs(10)); if (customSubjId) ((GridCacheQueryAdapter)q).subjectId(subjId); @@ -1285,7 +1285,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(3, new Person("Mike Green", 1000)); - QueryCursor<Cache.Entry<Integer, Person>> q = cache.query(new QueryTextPredicate(Person.class, "White")); + QueryCursor<Cache.Entry<Integer, Person>> q = cache.query(new QueryText(Person.class, "White")); if (customSubjId) ((GridCacheQueryAdapter)q).subjectId(subjId); @@ -1374,7 +1374,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, new Person("Person " + i, i)); QueryCursor<List<?>> q = cache - .queryFields(new QuerySqlPredicate("select _key, name from Person where salary > ?").setArgs(10)); + .queryFields(new QuerySql("select _key, name from Person where salary > ?").setArgs(10)); if (customSubjId) ((GridCacheQueryAdapter)q).subjectId(subjId);