diff --git a/processing/src/main/java/io/druid/query/ChainedExecutionQueryRunner.java b/processing/src/main/java/io/druid/query/ChainedExecutionQueryRunner.java index 60269822f1c..504372e5225 100644 --- a/processing/src/main/java/io/druid/query/ChainedExecutionQueryRunner.java +++ b/processing/src/main/java/io/druid/query/ChainedExecutionQueryRunner.java @@ -153,7 +153,7 @@ public class ChainedExecutionQueryRunner implements QueryRunner queryWatcher.registerQuery(query, futures); try { - final Number timeout = query.getContextValue("timeout", (Number) null); + final Number timeout = query.getContextValue(QueryContextKeys.TIMEOUT, (Number) null); return new MergeIterable<>( ordering.nullsFirst(), timeout == null ? diff --git a/processing/src/main/java/io/druid/query/GroupByParallelQueryRunner.java b/processing/src/main/java/io/druid/query/GroupByParallelQueryRunner.java index 552bea9085b..ae93c4778e7 100644 --- a/processing/src/main/java/io/druid/query/GroupByParallelQueryRunner.java +++ b/processing/src/main/java/io/druid/query/GroupByParallelQueryRunner.java @@ -138,7 +138,7 @@ public class GroupByParallelQueryRunner implements QueryRunner // Let the runners complete try { queryWatcher.registerQuery(query, futures); - final Number timeout = query.getContextValue("timeout", (Number) null); + final Number timeout = query.getContextValue(QueryContextKeys.TIMEOUT, (Number) null); if (timeout == null) { futures.get(); } else { diff --git a/processing/src/main/java/io/druid/query/groupby/GroupByQueryRunnerFactory.java b/processing/src/main/java/io/druid/query/groupby/GroupByQueryRunnerFactory.java index 58ccf98c083..8676200d708 100644 --- a/processing/src/main/java/io/druid/query/groupby/GroupByQueryRunnerFactory.java +++ b/processing/src/main/java/io/druid/query/groupby/GroupByQueryRunnerFactory.java @@ -37,6 +37,7 @@ import io.druid.query.AbstractPrioritizedCallable; import io.druid.query.ConcatQueryRunner; import io.druid.query.GroupByParallelQueryRunner; import io.druid.query.Query; +import io.druid.query.QueryContextKeys; import io.druid.query.QueryInterruptedException; import io.druid.query.QueryRunner; import io.druid.query.QueryRunnerFactory; @@ -143,7 +144,7 @@ public class GroupByQueryRunnerFactory implements QueryRunnerFactoryof("timeout", 1)), + query.withOverriddenContext(ImmutableMap.of(QueryContextKeys.TIMEOUT, 1)), Collections.EMPTY_MAP); try { diff --git a/processing/src/test/java/io/druid/query/ChainedExecutionQueryRunnerTest.java b/processing/src/test/java/io/druid/query/ChainedExecutionQueryRunnerTest.java index 346b485e799..c40b5056207 100644 --- a/processing/src/test/java/io/druid/query/ChainedExecutionQueryRunnerTest.java +++ b/processing/src/test/java/io/druid/query/ChainedExecutionQueryRunnerTest.java @@ -253,7 +253,7 @@ public class ChainedExecutionQueryRunnerTest .dataSource("test") .intervals("2014/2015") .aggregators(Lists.newArrayList(new CountAggregatorFactory("count"))) - .context(ImmutableMap.of("timeout", 100, "queryId", "test")) + .context(ImmutableMap.of(QueryContextKeys.TIMEOUT, 100, "queryId", "test")) .build(), context ); diff --git a/server/src/main/java/io/druid/server/QueryResource.java b/server/src/main/java/io/druid/server/QueryResource.java index 4da5d76725f..bd859c98b88 100644 --- a/server/src/main/java/io/druid/server/QueryResource.java +++ b/server/src/main/java/io/druid/server/QueryResource.java @@ -33,6 +33,7 @@ import com.metamx.emitter.service.ServiceEmitter; import io.druid.guice.annotations.Json; import io.druid.guice.annotations.Smile; import io.druid.query.Query; +import io.druid.query.QueryContextKeys; import io.druid.query.QueryInterruptedException; import io.druid.query.DruidMetrics; import io.druid.query.QuerySegmentWalker; @@ -136,10 +137,10 @@ public class QueryResource queryId = UUID.randomUUID().toString(); query = query.withId(queryId); } - if (query.getContextValue("timeout") == null) { + if (query.getContextValue(QueryContextKeys.TIMEOUT) == null) { query = query.withOverriddenContext( ImmutableMap.of( - "timeout", + QueryContextKeys.TIMEOUT, config.getMaxIdleTime().toStandardDuration().getMillis() ) );