Github user arina-ielchiieva commented on a diff in the pull request:
https://github.com/apache/drill/pull/1051#discussion_r154114792
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java ---
@@ -221,11 +200,15 @@ public QueryManager getQueryManager() {
}
/**
- * Cancel the query. Asynchronous -- it may take some time for all
remote fragments to be
- * terminated.
+ * Cancel the query. Asynchronous -- it may take some time for all
remote fragments to be terminated.
+ * For planning and enqueued states we cancel immediately since these
states are done locally.
+ *
+ * Note this can be called from outside of run() on another thread, or
after run() completes
*/
public void cancel() {
- // Note this can be called from outside of run() on another thread, or
after run() completes
+ if (QueryState.PLANNING == state || QueryState.ENQUEUED == state) {
+ moveToState(QueryState.CANCELLATION_REQUESTED, null);
--- End diff --
Fixed.
---