From 85656a467c66cffbe616dfa5e3646a0ac82b9afc Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Thu, 15 Jun 2023 23:32:20 -0700 Subject: [PATCH] MSQ: Load broadcast tables on workers. (#14437) They were not previously loaded because supportsQueries was false. This patch sets supportsQueries to true, and clarifies in Task javadocs that supportsQueries can be true for tasks that aren't directly queryable over HTTP. --- .../java/org/apache/druid/msq/indexing/MSQWorkerTask.java | 8 ++++++++ .../java/org/apache/druid/indexing/common/task/Task.java | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/MSQWorkerTask.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/MSQWorkerTask.java index d0dd70b0dd9..95abc6b03a6 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/MSQWorkerTask.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/MSQWorkerTask.java @@ -154,6 +154,14 @@ public class MSQWorkerTask extends AbstractTask return getContextValue(Tasks.PRIORITY_KEY, Tasks.DEFAULT_BATCH_INDEX_TASK_PRIORITY); } + @Override + public boolean supportsQueries() + { + // Even though we don't have a QueryResource, we do embed a query stack, and so we need preloaded resources + // such as broadcast tables. + return true; + } + @Override public boolean equals(Object o) { diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java index 1cc2d329c88..5c3186ef392 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/Task.java @@ -182,7 +182,12 @@ public interface Task QueryRunner getQueryRunner(Query query); /** - * @return true if this Task type is queryable, such as streaming ingestion tasks + * True if this task type embeds a query stack, and therefore should preload resources (like broadcast tables) + * that may be needed by queries. + * + * If true, {@link #getQueryRunner(Query)} does not necessarily return nonnull query runners. For example, + * MSQWorkerTask returns true from this method (because it embeds a query stack for running multi-stage queries) + * even though it is not directly queryable via HTTP. */ boolean supportsQueries();