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

timoninmaxim 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 9836647fa8e IGNITE-22219 Remove useless SqlQuery code in 
GridCacheQueryManager (#11347)
9836647fa8e is described below

commit 9836647fa8e7a0dc47f87295dba3c5c1cb720e03
Author: Maksim Timonin <[email protected]>
AuthorDate: Fri May 17 09:44:10 2024 +0300

    IGNITE-22219 Remove useless SqlQuery code in GridCacheQueryManager (#11347)
---
 .../cache/query/GridCacheQueryManager.java         | 98 +++++-----------------
 1 file changed, 22 insertions(+), 76 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index fec2585834a..b08fa52496c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -114,7 +114,6 @@ import org.apache.ignite.internal.util.typedef.CIX1;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
 import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.T3;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -147,7 +146,6 @@ import static 
org.apache.ignite.internal.processors.cache.distributed.dht.topolo
 import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.INDEX;
 import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SCAN;
 import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SPI;
-import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL;
 import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
 import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.TEXT;
 import static 
org.apache.ignite.internal.processors.security.SecurityUtils.securitySubjectId;
@@ -535,7 +533,6 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
      * Performs query.
      *
      * @param qry Query.
-     * @param args Arguments.
      * @param loc Local query or not.
      * @param taskName Task name.
      * @param rcpt ID of the recipient.
@@ -543,7 +540,7 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
      * @throws IgniteCheckedException In case of error.
      */
     @SuppressWarnings("unchecked")
-    private QueryResult<K, V> executeQuery(GridCacheQueryAdapter<?> qry, 
@Nullable Object[] args,
+    private QueryResult<K, V> executeQuery(GridCacheQueryAdapter<?> qry,
         IgniteClosure transformer, boolean loc, @Nullable String taskName, 
Object rcpt)
         throws IgniteCheckedException {
         if (qry.type() == null) {
@@ -554,33 +551,12 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
                 "CacheConfiguration.getMaxQueryIteratorsCount() configuration 
property).");
         }
 
-        QueryResult<K, V> res;
-
-        T3<String, String, List<Object>> resKey = null;
-
-        if (qry.type() == SQL) {
-            resKey = new T3<>(qry.queryClassName(), qry.clause(), 
F.asList(args));
-
-            res = (QueryResult<K, V>)qryResCache.get(resKey);
-
-            if (res != null && res.addRecipient(rcpt))
-                return res;
-
-            res = new QueryResult<>(qry.type(), rcpt);
-
-            if (qryResCache.putIfAbsent(resKey, res) != null)
-                resKey = null;
-        }
-        else
-            res = new QueryResult<>(qry.type(), rcpt);
+        QueryResult<K, V> res = new QueryResult<>(qry.type(), rcpt);
 
         GridCloseableIterator<IgniteBiTuple<K, V>> iter;
 
         try {
             switch (qry.type()) {
-                case SQL:
-                    throw new IllegalStateException("Should never be called.");
-
                 case SCAN:
                     if (cctx.events().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
                         cctx.gridEvents().record(new CacheQueryExecutedEvent<>(
@@ -670,10 +646,6 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
         catch (Exception e) {
             res.onDone(e);
         }
-        finally {
-            if (resKey != null)
-                qryResCache.remove(resKey, res);
-        }
 
         return res;
     }
@@ -1171,7 +1143,7 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
                 GridCacheQueryType type;
 
                 res = loc ?
-                    executeQuery(qry, qryInfo.arguments(), trans, loc, 
taskName,
+                    executeQuery(qry, trans, loc, taskName,
                         recipient(qryInfo.senderId(), qryInfo.requestId())) :
                     queryResult(qryInfo, taskName);
 
@@ -1259,53 +1231,27 @@ public abstract class GridCacheQueryManager<K, V> 
extends GridCacheManagerAdapte
                         K key0 = null;
                         V val0 = null;
 
-                        if (readEvt && 
cctx.gridEvents().hasListener(EVT_CACHE_QUERY_OBJECT_READ)) {
+                        if (type == TEXT && readEvt && 
cctx.gridEvents().hasListener(EVT_CACHE_QUERY_OBJECT_READ)) {
                             key0 = 
(K)CacheObjectUtils.unwrapBinaryIfNeeded(objCtx, key, qry.keepBinary(), false, 
null);
                             val0 = 
(V)CacheObjectUtils.unwrapBinaryIfNeeded(objCtx, val, qry.keepBinary(), false, 
null);
 
-                            switch (type) {
-                                case SQL:
-                                    cctx.gridEvents().record(new 
CacheQueryReadEvent<>(
-                                        cctx.localNode(),
-                                        "SQL query entry read.",
-                                        EVT_CACHE_QUERY_OBJECT_READ,
-                                        CacheQueryType.SQL.name(),
-                                        cctx.name(),
-                                        qry.queryClassName(),
-                                        qry.clause(),
-                                        null,
-                                        null,
-                                        qryInfo.arguments(),
-                                        securitySubjectId(cctx),
-                                        taskName,
-                                        key0,
-                                        val0,
-                                        null,
-                                        null));
-
-                                    break;
-
-                                case TEXT:
-                                    cctx.gridEvents().record(new 
CacheQueryReadEvent<>(
-                                        cctx.localNode(),
-                                        "Full text query entry read.",
-                                        EVT_CACHE_QUERY_OBJECT_READ,
-                                        CacheQueryType.FULL_TEXT.name(),
-                                        cctx.name(),
-                                        qry.queryClassName(),
-                                        qry.clause(),
-                                        null,
-                                        null,
-                                        null,
-                                        securitySubjectId(cctx),
-                                        taskName,
-                                        key0,
-                                        val0,
-                                        null,
-                                        null));
-
-                                    break;
-                            }
+                            cctx.gridEvents().record(new CacheQueryReadEvent<>(
+                                cctx.localNode(),
+                                "Full text query entry read.",
+                                EVT_CACHE_QUERY_OBJECT_READ,
+                                CacheQueryType.FULL_TEXT.name(),
+                                cctx.name(),
+                                qry.queryClassName(),
+                                qry.clause(),
+                                null,
+                                null,
+                                null,
+                                securitySubjectId(cctx),
+                                taskName,
+                                key0,
+                                val0,
+                                null,
+                                null));
                         }
 
                         if (rdc != null) {
@@ -1560,7 +1506,7 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
 
         if (exec) {
             try {
-                fut.onDone(executeQuery(qryInfo.query(), qryInfo.arguments(), 
qryInfo.transformer(), false,
+                fut.onDone(executeQuery(qryInfo.query(), 
qryInfo.transformer(), false,
                     taskName, recipient(qryInfo.senderId(), 
qryInfo.requestId())));
             }
             catch (Throwable e) {

Reply via email to