kfaraz commented on code in PR #16266:
URL: https://github.com/apache/druid/pull/16266#discussion_r1573329870
##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/ForkingTaskRunnerTest.java:
##########
@@ -537,6 +539,78 @@ ProcessHolder runTaskProcess(List<String> command, File
logFile, TaskLocation ta
Assert.assertTrue(forkingTaskRunner.restore().isEmpty());
}
+ @Test
+ public void testTaskRunDoesntPassLoadLookupsArgument() throws Exception
+ {
+ verifyTaskRunLoadLookupsArgument(LookupLoadingMode.ALL);
+ }
+
+ @Test
+ public void testTaskRunPassLoadLookupsArgument() throws Exception
+ {
+ verifyTaskRunLoadLookupsArgument(LookupLoadingMode.NONE);
+ }
+
+ private void verifyTaskRunLoadLookupsArgument(LookupLoadingMode
lookupLoadingMode) throws Exception
+ {
+ ObjectMapper mapper = new DefaultObjectMapper();
+ Task task = new NoopTask(null, null, null, 0, 0, null) {
+ @Override
+ public LookupLoadingMode loadLookups()
+ {
+ return lookupLoadingMode;
+ }
+ };
+ File file = temporaryFolder.newFolder();
+ TaskConfig taskConfig = makeDefaultTaskConfigBuilder()
+ .setBaseTaskDir(file.toString())
+ .build();
+ final WorkerConfig workerConfig = new WorkerConfig();
+ ForkingTaskRunner forkingTaskRunner = new ForkingTaskRunner(
+ new ForkingTaskRunnerConfig(),
+ taskConfig,
+ workerConfig,
+ new Properties(),
+ new NoopTaskLogs(),
+ mapper,
+ new DruidNode("middleManager", "host", false, 8091, null, true, false),
+ new StartupLoggingConfig(),
+ TaskStorageDirTracker.fromConfigs(workerConfig, taskConfig)
+ )
+ {
+ @Override
+ ProcessHolder runTaskProcess(List<String> command, File logFile,
TaskLocation taskLocation) throws IOException
+ {
+ if (lookupLoadingMode == LookupLoadingMode.NONE) {
+
Assert.assertTrue(command.containsAll(ImmutableSet.of("--loadLookups",
LookupLoadingMode.NONE.name())));
+ } else {
+
Assert.assertFalse(command.containsAll(ImmutableSet.of("--loadLookups",
LookupLoadingMode.NONE.name())));
Review Comment:
Nit:
This assertion should be broken up to ensure that neither of the values are
present.
```suggestion
Assert.assertFalse(command.contains("--loadLookups"));
Assert.assertFalse(command.contains(LookupLoadingMode.NONE.name()));
```
##########
server/src/main/java/org/apache/druid/query/lookup/LookupLoadingMode.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.query.lookup;
+
+/**
+ * This enum describes different modes of loading lookups
+ * <p>Each task might define if it needs to load lookups or not {@link
org.apache.druid.indexing.common.task.Task#loadLookups}
+ * <p>Values:
+ * <ul>
+ * <li>ALL - represents regular mode of loading all lookups </li>
+ * <li>NONE - represents mode when no lookups will be loaded </li>
+ * <li>ON_DEMAND - currently not supported and will be used in the future </li>
+ * </ul>
+ */
+public enum LookupLoadingMode
+{
+ NONE, ALL, ON_DEMAND
Review Comment:
Should we comment out the `ON_DEMAND` value right now so that no tasks end
up using it causing an exception in `CliPeon`? We can uncomment it when we have
an actual implementation for it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]