You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2019/04/04 08:29:08 UTC

[ignite] branch master updated: IGNITE-11334: SQL: Deprecated SqlQuery in Java. This closes #6151.

This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new e1ab893  IGNITE-11334: SQL: Deprecated SqlQuery in Java. This closes #6151.
e1ab893 is described below

commit e1ab893540e069e25c59d2c909a33f4fd0cee1cb
Author: tledkov <tl...@gridgain.com>
AuthorDate: Thu Apr 4 11:28:56 2019 +0300

    IGNITE-11334: SQL: Deprecated SqlQuery in Java. This closes #6151.
---
 .../datagrid/CacheClientBinaryQueryExample.java    | 133 +++++++--------------
 .../examples/datagrid/CacheQueryExample.java       |   3 +-
 .../starschema/CacheStarSchemaExample.java         |  25 ++--
 .../ignite/examples/sql/SqlQueriesExample.java     |  29 ++---
 .../main/java/org/apache/ignite/IgniteCache.java   |   2 -
 .../java/org/apache/ignite/cache/query/Query.java  |   2 -
 .../apache/ignite/cache/query/SqlFieldsQuery.java  |   3 +-
 .../org/apache/ignite/cache/query/SqlQuery.java    |   3 +
 .../java/org/apache/ignite/client/ClientCache.java |   3 +-
 .../internal/jdbc/thin/JdbcThinStatement.java      |   4 +-
 10 files changed, 78 insertions(+), 129 deletions(-)

diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
index a3c9996..0c9becc 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
@@ -19,12 +19,13 @@ package org.apache.ignite.examples.binary.datagrid;
 
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.LinkedHashMap;
+import java.util.Collections;
 import java.util.List;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.cache.CacheKeyConfiguration;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.QueryEntity;
@@ -32,7 +33,6 @@ import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.QueryIndexType;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.TextQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.model.Address;
@@ -40,17 +40,16 @@ import org.apache.ignite.examples.model.Employee;
 import org.apache.ignite.examples.model.EmployeeKey;
 import org.apache.ignite.examples.model.Organization;
 import org.apache.ignite.examples.model.OrganizationType;
-import org.apache.ignite.binary.BinaryObject;
 
 /**
- * This example demonstrates use of binary objects with cache queries.
- * The example populates cache with sample data and runs several SQL and full text queries over this data.
+ * This example demonstrates use of binary objects with cache queries. The example populates cache with sample data and
+ * runs several SQL and full text queries over this data.
  * <p>
- * Remote nodes should always be started with the following command:
- * {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}
+ * Remote nodes should always be started with the following command: {@code 'ignite.{sh|bat}
+ * examples/config/example-ignite.xml'}
  * <p>
- * Alternatively you can run {@link org.apache.ignite.examples.ExampleNodeStartup} in another JVM which will
- * start a node with {@code examples/config/example-ignite.xml} configuration.
+ * Alternatively you can run {@link org.apache.ignite.examples.ExampleNodeStartup} in another JVM which will start a
+ * node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheClientBinaryQueryExample {
     /** Organization cache name. */
@@ -106,15 +105,12 @@ public class CacheClientBinaryQueryExample {
                 // Get cache that will work with binary objects.
                 IgniteCache<BinaryObject, BinaryObject> binaryCache = employeeCache.withKeepBinary();
 
-                // Run SQL query example.
-                sqlQuery(binaryCache);
+                // Run SQL fields query example.
+                sqlFieldsQuery(binaryCache);
 
                 // Run SQL query with join example.
                 sqlJoinQuery(binaryCache);
 
-                // Run SQL fields query example.
-                sqlFieldsQuery(binaryCache);
-
                 // Run full text query example.
                 textQuery(binaryCache);
 
@@ -134,30 +130,21 @@ public class CacheClientBinaryQueryExample {
      * @return Cache type metadata.
      */
     private static QueryEntity createEmployeeQueryEntity() {
-        QueryEntity employeeEntity = new QueryEntity();
-
-        employeeEntity.setValueType(Employee.class.getName());
-        employeeEntity.setKeyType(EmployeeKey.class.getName());
-
-        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
-
-        fields.put("name", String.class.getName());
-        fields.put("salary", Long.class.getName());
-        fields.put("addr.zip", Integer.class.getName());
-        fields.put("organizationId", Integer.class.getName());
-        fields.put("addr.street", Integer.class.getName());
-
-        employeeEntity.setFields(fields);
-
-        employeeEntity.setIndexes(Arrays.asList(
-            new QueryIndex("name"),
-            new QueryIndex("salary"),
-            new QueryIndex("addr.zip"),
-            new QueryIndex("organizationId"),
-            new QueryIndex("addr.street", QueryIndexType.FULLTEXT)
-        ));
-
-        return employeeEntity;
+        return new QueryEntity()
+            .setValueType(Employee.class.getName())
+            .setKeyType(EmployeeKey.class.getName())
+            .addQueryField("organizationId", Integer.class.getName(), null)
+            .addQueryField("name", String.class.getName(), null)
+            .addQueryField("salary", Long.class.getName(), null)
+            .addQueryField("addr.zip", Integer.class.getName(), null)
+            .addQueryField("addr.street", String.class.getName(), null)
+            .setKeyFields(Collections.singleton("organizationId"))
+            .setIndexes(Arrays.asList(
+                new QueryIndex("name"),
+                new QueryIndex("salary"),
+                new QueryIndex("addr.zip"),
+                new QueryIndex("organizationId"),
+                new QueryIndex("addr.street", QueryIndexType.FULLTEXT)));
     }
 
     /**
@@ -166,42 +153,32 @@ public class CacheClientBinaryQueryExample {
      * @return Cache type metadata.
      */
     private static QueryEntity createOrganizationQueryEntity() {
-        QueryEntity organizationEntity = new QueryEntity();
-
-        organizationEntity.setValueType(Organization.class.getName());
-        organizationEntity.setKeyType(Integer.class.getName());
-
-        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
-
-        fields.put("name", String.class.getName());
-        fields.put("address.street", String.class.getName());
-
-        organizationEntity.setFields(fields);
-
-        organizationEntity.setIndexes(Arrays.asList(
-            new QueryIndex("name")
-        ));
-
-        return organizationEntity;
+        return new QueryEntity()
+            .setValueType(Organization.class.getName())
+            .setKeyType(Integer.class.getName())
+            .addQueryField("keyId", Integer.class.getName(), null)
+            .addQueryField("name", String.class.getName(), null)
+            .addQueryField("address.street", String.class.getName(), null)
+            .setKeyFieldName("keyId")
+            .setIndexes(Arrays.asList(
+                new QueryIndex("name")));
     }
 
     /**
-     * Queries employees that have provided ZIP code in address.
+     * Queries names and salaries for all employees.
      *
      * @param cache Ignite cache.
      */
-    private static void sqlQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
-        SqlQuery<BinaryObject, BinaryObject> query = new SqlQuery<>(Employee.class, "zip = ?");
-
-        int zip = 94109;
+    private static void sqlFieldsQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
+        SqlFieldsQuery qry = new SqlFieldsQuery("select name, salary from Employee");
 
-        QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees = cache.query(query.setArgs(zip));
+        QueryCursor<List<?>> employees = cache.query(qry);
 
         System.out.println();
-        System.out.println(">>> Employees with zip " + zip + ':');
+        System.out.println(">>> Employee names and their salaries:");
 
-        for (Cache.Entry<BinaryObject, BinaryObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue().deserialize());
+        for (List<?> row : employees.getAll())
+            System.out.println(">>>     [Name=" + row.get(0) + ", salary=" + row.get(1) + ']');
     }
 
     /**
@@ -210,37 +187,19 @@ public class CacheClientBinaryQueryExample {
      * @param cache Ignite cache.
      */
     private static void sqlJoinQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
-        SqlQuery<BinaryObject, BinaryObject> qry = new SqlQuery<>(Employee.class,
-            "from Employee, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
-                "where Employee.organizationId = org._key and org.name = ?");
+        SqlFieldsQuery qry = new SqlFieldsQuery(
+            "select e.* from Employee e, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
+                "where e.organizationId = org.keyId and org.name = ?");
 
         String organizationName = "GridGain";
 
-        QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees =
-            cache.query(qry.setArgs(organizationName));
+        QueryCursor<List<?>> employees = cache.query(qry.setArgs(organizationName));
 
         System.out.println();
         System.out.println(">>> Employees working for " + organizationName + ':');
 
-        for (Cache.Entry<BinaryObject, BinaryObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue());
-    }
-
-    /**
-     * Queries names and salaries for all employees.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlFieldsQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
-        SqlFieldsQuery qry = new SqlFieldsQuery("select name, salary from Employee");
-
-        QueryCursor<List<?>> employees = cache.query(qry);
-
-        System.out.println();
-        System.out.println(">>> Employee names and their salaries:");
-
         for (List<?> row : employees.getAll())
-            System.out.println(">>>     [Name=" + row.get(0) + ", salary=" + row.get(1) + ']');
+            System.out.println(">>>     " + row);
     }
 
     /**
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
index 7a1d25f..86e866e 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
@@ -27,7 +27,6 @@ import org.apache.ignite.cache.affinity.AffinityKey;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.TextQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
@@ -49,7 +48,7 @@ import org.apache.ignite.lang.IgniteBiPredicate;
  *         collocated mode. Refer to {@link AffinityKey} javadoc for more details.
  *         <p>
  *         To use distributed joins it is necessary to set query 'distributedJoin' flag using
- *         {@link SqlFieldsQuery#setDistributedJoins(boolean)} or {@link SqlQuery#setDistributedJoins(boolean)}.
+ *         {@link SqlFieldsQuery#setDistributedJoins(boolean)}.
  *     </li>
  *     <li>
  *         Note that if you created query on to replicated cache, all data will
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
index 6a53b89..3797017 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java
@@ -20,6 +20,7 @@ package org.apache.ignite.examples.datagrid.starschema;
 import java.util.Collection;
 import java.util.ConcurrentModificationException;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ThreadLocalRandom;
 import javax.cache.Cache;
@@ -29,7 +30,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
 
@@ -176,10 +177,9 @@ public class CacheStarSchemaExample {
         // ========================
 
         // Create cross cache query to get all purchases made at store1.
-        QueryCursor<Cache.Entry<Integer, FactPurchase>> storePurchases = factCache.query(new SqlQuery(
-            FactPurchase.class,
-            "from \"" + DIM_STORE_CACHE_NAME + "\".DimStore, \"" + FACT_CACHE_NAME + "\".FactPurchase "
-                + "where DimStore.id=FactPurchase.storeId and DimStore.name=?").setArgs("Store1"));
+        QueryCursor<List<?>> storePurchases = factCache.query(new SqlFieldsQuery(
+            "select fp.* from \"" + DIM_STORE_CACHE_NAME + "\".DimStore, \"" + FACT_CACHE_NAME + "\".FactPurchase as fp "
+                + "where DimStore.id=fp.storeId and DimStore.name=?").setArgs("Store1"));
 
         printQueryResults("All purchases made at store1:", storePurchases.getAll());
     }
@@ -206,11 +206,10 @@ public class CacheStarSchemaExample {
 
         // Create cross cache query to get all purchases made at store2
         // for specified products.
-        QueryCursor<Cache.Entry<Integer, FactPurchase>> prodPurchases = factCache.query(new SqlQuery(
-            FactPurchase.class,
-            "from \"" + DIM_STORE_CACHE_NAME + "\".DimStore, \"" + DIM_PROD_CACHE_NAME + "\".DimProduct, " +
-                "\"" + FACT_CACHE_NAME + "\".FactPurchase "
-                + "where DimStore.id=FactPurchase.storeId and DimProduct.id=FactPurchase.productId "
+        QueryCursor<List<?>> prodPurchases = factCache.query(new SqlFieldsQuery(
+            "select fp.* from \"" + DIM_STORE_CACHE_NAME + "\".DimStore, \"" + DIM_PROD_CACHE_NAME + "\".DimProduct, " +
+                "\"" + FACT_CACHE_NAME + "\".FactPurchase as fp "
+                + "where DimStore.id=fp.storeId and DimProduct.id=fp.productId "
                 + "and DimStore.name=? and DimProduct.id in(?, ?, ?)")
             .setArgs("Store2", p1.getId(), p2.getId(), p3.getId()));
 
@@ -223,11 +222,11 @@ public class CacheStarSchemaExample {
      * @param msg Initial message.
      * @param res Results to print.
      */
-    private static <V> void printQueryResults(String msg, Iterable<Cache.Entry<Integer, V>> res) {
+    private static void printQueryResults(String msg, Iterable<List<?>> res) {
         System.out.println(msg);
 
-        for (Cache.Entry<?, ?> e : res)
-            System.out.println("    " + e.getValue().toString());
+        for (List<?> row : res)
+            System.out.println("    " + row.toString());
     }
 
     /**
diff --git a/examples/src/main/java/org/apache/ignite/examples/sql/SqlQueriesExample.java b/examples/src/main/java/org/apache/ignite/examples/sql/SqlQueriesExample.java
index 77d3629..f3b9979 100644
--- a/examples/src/main/java/org/apache/ignite/examples/sql/SqlQueriesExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/sql/SqlQueriesExample.java
@@ -25,7 +25,6 @@ import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.affinity.AffinityKey;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.ExampleNodeStartup;
 import org.apache.ignite.examples.model.Organization;
@@ -44,7 +43,7 @@ import org.apache.ignite.examples.model.Person;
  *         collocated mode. Refer to {@link AffinityKey} javadoc for more details.
  *         <p>
  *         To use distributed joins it is necessary to set query 'distributedJoin' flag using
- *         {@link SqlFieldsQuery#setDistributedJoins(boolean)} or {@link SqlQuery#setDistributedJoins(boolean)}.
+ *         {@link SqlFieldsQuery#setDistributedJoins(boolean)}.
  *     </li>
  *     <li>
  *         Note that if you created query on to replicated cache, all data will
@@ -144,16 +143,15 @@ public class SqlQueriesExample {
         IgniteCache<Long, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
 
         // SQL clause which selects salaries based on range.
-        String sql = "salary > ? and salary <= ?";
+        // Extract fields of the entry.
+        String sql = "select * from Person where salary > ? and salary <= ?";
 
         // Execute queries for salary ranges.
         print("People with salaries between 0 and 1000 (queried with SQL query): ",
-            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, sql).
-                setArgs(0, 1000)).getAll());
+            cache.query(new SqlFieldsQuery(sql).setArgs(0, 1000)).getAll());
 
         print("People with salaries between 1000 and 2000 (queried with SQL query): ",
-            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, sql).
-                setArgs(1000, 2000)).getAll());
+            cache.query(new SqlFieldsQuery(sql).setArgs(1000, 2000)).getAll());
     }
 
     /**
@@ -164,18 +162,16 @@ public class SqlQueriesExample {
 
         // SQL clause query which joins on 2 types to select people for a specific organization.
         String joinSql =
-            "from Person, \"" + ORG_CACHE + "\".Organization as org " +
-            "where Person.orgId = org.id " +
+            "select pers.* from Person as pers, \"" + ORG_CACHE + "\".Organization as org " +
+            "where pers.orgId = org.id " +
             "and lower(org.name) = lower(?)";
 
         // Execute queries for find employees for different organizations.
         print("Following people are 'ApacheIgnite' employees: ",
-            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, joinSql).
-                setArgs("ApacheIgnite")).getAll());
+            cache.query(new SqlFieldsQuery(joinSql).setArgs("ApacheIgnite")).getAll());
 
         print("Following people are 'Other' employees: ",
-            cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, joinSql).
-                setArgs("Other")).getAll());
+            cache.query(new SqlFieldsQuery(joinSql).setArgs("Other")).getAll());
     }
 
     /**
@@ -187,12 +183,11 @@ public class SqlQueriesExample {
 
         // SQL clause query which joins on 2 types to select people for a specific organization.
         String joinSql =
-            "from Person, \"" + ORG_CACHE + "\".Organization as org " +
-            "where Person.orgId = org.id " +
+            "select pers.* from Person as pers, \"" + ORG_CACHE + "\".Organization as org " +
+            "where pers.orgId = org.id " +
             "and lower(org.name) = lower(?)";
 
-        SqlQuery qry = new SqlQuery<Long, Person>(Person.class, joinSql).
-            setArgs("ApacheIgnite");
+        SqlFieldsQuery qry = new SqlFieldsQuery(joinSql).setArgs("ApacheIgnite");
 
         // Enable distributed joins for query.
         qry.setDistributedJoins(true);
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 12329db..8e6918a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -51,7 +51,6 @@ import org.apache.ignite.cache.query.QueryMetrics;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cache.query.SpiQuery;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.TextQuery;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cluster.ClusterGroup;
@@ -366,7 +365,6 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @param qry Query.
      * @return Cursor.
      * @see ScanQuery
-     * @see SqlQuery
      * @see SqlFieldsQuery
      * @see TextQuery
      * @see SpiQuery
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
index 3b3786f..6726c49 100644
--- 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
@@ -31,8 +31,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
  * <ul>
  * <li><b>SQL Fields query.</b>Provides SQL way with full syntax to access cache data.
  * See {@link SqlFieldsQuery} for details.</li>
- * <li><b>SQL query.</b> Provides SQL way with simplified syntax to access cache data.
- *  See {@link SqlQuery} for details.</li>
  * <li><b>Full-text query.</b> Uses full-text search engine based on Apache Lucene engine.
  * See {@link TextQuery} for details.</li>
  * <li><b>Scan query.</b> Provides effective and flexible way to full cache\partition scan.
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
index aa66716..d3bd1d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
@@ -30,8 +30,7 @@ import org.jetbrains.annotations.Nullable;
 
 /**
  * SQL Fields query. This query can return specific fields of data based
- * on SQL {@code 'select'} clause, as opposed to {@link SqlQuery}, which always returns
- * the whole key and value objects back.
+ * on SQL {@code 'select'} clause.
  * <h1 class="header">Collocated Flag</h1>
  * Collocation flag is used for optimization purposes. Whenever Ignite executes
  * a distributed query, it sends sub-queries to individual cluster members.
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
index 7cb97c8..778dc0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
@@ -32,7 +32,10 @@ import org.jetbrains.annotations.Nullable;
  * SQL Query.
  *
  * @see IgniteCache#query(Query)
+ *
+ * @deprecated Since 2.8, please use {@link SqlFieldsQuery} instead.
  */
+@Deprecated
 public final class SqlQuery<K, V> extends Query<Cache.Entry<K, V>> {
     /** */
     private static final long serialVersionUID = 0L;
diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCache.java b/modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
index 168b30b..2f0a044 100644
--- a/modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/client/ClientCache.java
@@ -28,7 +28,6 @@ import org.apache.ignite.cache.query.Query;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
 
 /**
  * Thin client cache.
@@ -338,7 +337,7 @@ public interface ClientCache<K, V> {
     public <K1, V1> ClientCache<K1, V1> withKeepBinary();
 
     /**
-     * Queries cache. Supports {@link ScanQuery}, {@link SqlQuery} and {@link SqlFieldsQuery}.
+     * Queries cache. Supports {@link ScanQuery} and {@link SqlFieldsQuery}.
      *
      * @param qry Query.
      * @return Cursor.
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
index 565ea56..55d69f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
@@ -32,7 +32,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.Query;
 import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.odbc.ClientListenerResponse;
 import org.apache.ignite.internal.processors.odbc.SqlStateCode;
@@ -65,7 +65,7 @@ import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
  */
 public class JdbcThinStatement implements Statement {
     /** Default queryPage size. */
-    private static final int DFLT_PAGE_SIZE = SqlQuery.DFLT_PAGE_SIZE;
+    private static final int DFLT_PAGE_SIZE = Query.DFLT_PAGE_SIZE;
 
     /** JDBC Connection implementation. */
     protected final JdbcThinConnection conn;