ivandasch commented on a change in pull request #9767:
URL: https://github.com/apache/ignite/pull/9767#discussion_r801411648



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/QueryRegistryImpl.java
##########
@@ -21,50 +21,90 @@
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-
-import org.apache.ignite.IgniteLogger;
+import java.util.stream.Collectors;
+import org.apache.calcite.util.Pair;
+import org.apache.ignite.cache.query.QueryCancelledException;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
+import org.apache.ignite.internal.processors.query.GridQueryCancel;
 import org.apache.ignite.internal.processors.query.RunningQuery;
+import org.apache.ignite.internal.processors.query.RunningQueryManager;
+import 
org.apache.ignite.internal.processors.query.calcite.util.AbstractService;
 import org.apache.ignite.internal.util.IgniteUtils;
 
 /**
  * Registry of the running queries.
  */
-public class QueryRegistryImpl implements QueryRegistry {
+public class QueryRegistryImpl extends AbstractService implements 
QueryRegistry {
     /** */
-    private final ConcurrentMap<UUID, RunningQuery> runningQrys = new 
ConcurrentHashMap<>();
+    private final ConcurrentMap<UUID, Pair<Long, RunningQuery>> runningQrys = 
new ConcurrentHashMap<>();
 
     /** */
-    private final IgniteLogger log;
+    protected final GridKernalContext kctx;
 
     /** */
-    public QueryRegistryImpl(IgniteLogger log) {
-        this.log = log;
+    public QueryRegistryImpl(GridKernalContext ctx) {
+        super(ctx);
+
+        kctx = ctx;
     }
 
     /** {@inheritDoc} */
     @Override public RunningQuery register(RunningQuery qry) {
-        return runningQrys.computeIfAbsent(qry.id(), k -> qry);
+        return runningQrys.computeIfAbsent(qry.id(), k -> {
+            if (!(qry instanceof RootQuery))
+                return Pair.of(-1L, qry);
+
+            String nodeId;
+            if (qry.initiatorNodeId() != null)
+                nodeId = qry.initiatorNodeId().toString();

Review comment:
       I suppose that better to override this method for RootQuery




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to