You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/05/04 09:17:31 UTC

[GitHub] [ignite-3] AMashenkov commented on a diff in pull request #712: IGNITE-16401 Working in async manner for new SQL engine

AMashenkov commented on code in PR #712:
URL: https://github.com/apache/ignite-3/pull/712#discussion_r864616477


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -276,192 +205,438 @@ private QueryPlan prepareFragment(String jsonFragment) {
 
     /** {@inheritDoc} */
     @Override
-    public SqlCursor<List<?>> executePlan(
-            RootQuery<RowT> qry,
-            QueryPlan plan
+    public AsyncCursor<List<Object>> executePlan(
+            QueryPlan plan, BaseQueryContext ctx
     ) {
         switch (plan.type()) {
             case DML:
                 // TODO a barrier between previous operation and this one
             case QUERY:
-                return mapAndExecutePlan(
-                        qry,
+                return executeQuery(
+                        ctx,
                         (MultiStepPlan) plan
                 );
             case EXPLAIN:
                 return executeExplain((ExplainPlan) plan);
             case DDL:
-                return executeDdl(qry, (DdlPlan) plan);
+                return executeDdl((DdlPlan) plan);
 
             default:
                 throw new AssertionError("Unexpected plan type: " + plan);
         }
     }
 
-    private SqlCursor<List<?>> executeDdl(RootQuery<RowT> qry, DdlPlan plan) {
+    /** Cancels the query with given id. */
+    public CompletionStage<?> cancel(UUID qryId) {
+        var mgr = queryManagerMap.get(qryId);
+
+        if (mgr == null) {
+            return CompletableFuture.completedFuture(null);
+        }
+
+        return mgr.close(true);
+    }
+
+    private AsyncCursor<List<Object>> executeDdl(DdlPlan plan) {
         try {
             ddlCmdHnd.handle(plan.command());
         } catch (IgniteInternalCheckedException e) {
-            throw new IgniteInternalException("Failed to execute DDL statement [stmt=" + qry.sql()
+            throw new IgniteInternalException("Failed to execute DDL statement [stmt=" /*+ qry.sql()*/

Review Comment:
   Should we return here a future that completed exceptionally?



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org