You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by am...@apache.org on 2023/07/31 11:53:04 UTC

[druid] branch 27.0.0 updated: make sure execution mode is set (#14606) (#14705)

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

amatya pushed a commit to branch 27.0.0
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/27.0.0 by this push:
     new 0ee90d7306 make sure execution mode is set (#14606) (#14705)
0ee90d7306 is described below

commit 0ee90d7306087ce80d6e7885ecc0bc4fd3534aba
Author: AmatyaAvadhanula <am...@imply.io>
AuthorDate: Mon Jul 31 17:22:55 2023 +0530

    make sure execution mode is set (#14606) (#14705)
    
    Co-authored-by: Vadim Ogievetsky <va...@ogievetsky.com>
---
 .../__snapshots__/rule-editor.spec.tsx.snap        | 13 +++-------
 .../components/rule-editor/rule-editor.spec.tsx    |  2 +-
 .../src/helpers/execution/sql-task-execution.ts    | 29 +++++++++++++---------
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap b/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap
index 7c2772d8b1..d6892f3c1b 100644
--- a/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap
+++ b/web-console/src/components/rule-editor/__snapshots__/rule-editor.spec.tsx.snap
@@ -195,19 +195,14 @@ exports[`RuleEditor matches snapshot no tier in rule 1`] = `
                     test1
                   </option>
                   <option
-                    value="test"
-                  >
-                    test
-                  </option>
-                  <option
-                    value="test"
+                    value="test2"
                   >
-                    test
+                    test2
                   </option>
                   <option
-                    value="test"
+                    value="test3"
                   >
-                    test
+                    test3
                   </option>
                 </select>
                 <span
diff --git a/web-console/src/components/rule-editor/rule-editor.spec.tsx b/web-console/src/components/rule-editor/rule-editor.spec.tsx
index cfd3631ef6..7c4580f724 100644
--- a/web-console/src/components/rule-editor/rule-editor.spec.tsx
+++ b/web-console/src/components/rule-editor/rule-editor.spec.tsx
@@ -26,7 +26,7 @@ describe('RuleEditor', () => {
     const ruleEditor = (
       <RuleEditor
         rule={{ type: 'loadForever', tieredReplicants: { test1: 1 } }}
-        tiers={['test', 'test', 'test']}
+        tiers={['test1', 'test2', 'test3']}
         onChange={() => {}}
         onDelete={() => {}}
         moveUp={undefined}
diff --git a/web-console/src/helpers/execution/sql-task-execution.ts b/web-console/src/helpers/execution/sql-task-execution.ts
index 2aeff4896e..79e28e486d 100644
--- a/web-console/src/helpers/execution/sql-task-execution.ts
+++ b/web-console/src/helpers/execution/sql-task-execution.ts
@@ -36,6 +36,15 @@ const USE_TASK_REPORTS = true;
 const WAIT_FOR_SEGMENT_METADATA_TIMEOUT = 180000; // 3 minutes to wait until segments appear in the metadata
 const WAIT_FOR_SEGMENT_LOAD_TIMEOUT = 540000; // 9 minutes to wait for segments to load at all
 
+// some executionMode has to be set on the /druid/v2/sql/statements API
+function ensureExecutionModeIsSet(context: QueryContext | undefined): QueryContext {
+  if (typeof context?.executionMode === 'string') return context;
+  return {
+    ...context,
+    executionMode: 'async',
+  };
+}
+
 export interface SubmitTaskQueryOptions {
   query: string | Record<string, any>;
   context?: QueryContext;
@@ -65,26 +74,22 @@ export async function submitTaskQuery(
     sqlQuery = query;
     jsonQuery = {
       query: sqlQuery,
+      context: ensureExecutionModeIsSet(context),
       resultFormat: 'array',
       header: true,
       typesHeader: true,
       sqlTypesHeader: true,
-      context: context,
     };
   } else {
     sqlQuery = query.query;
 
-    if (context) {
-      jsonQuery = {
-        ...query,
-        context: {
-          ...(query.context || {}),
-          ...context,
-        },
-      };
-    } else {
-      jsonQuery = query;
-    }
+    jsonQuery = {
+      ...query,
+      context: ensureExecutionModeIsSet({
+        ...query.context,
+        ...context,
+      }),
+    };
   }
 
   let sqlAsyncResp: AxiosResponse<AsyncStatusResponse>;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org