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 7c2772d8b13..d6892f3c1b3 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 - { const ruleEditor = ( {}} 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 2aeff4896e8..79e28e486d3 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; 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;