io.druid.query.Query.withOverriddenContext()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中io.druid.query.Query.withOverriddenContext方法的一些代码示例,展示了Query.withOverriddenContext的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.withOverriddenContext方法的具体详情如下:
包路径:io.druid.query.Query
类名称:Query
方法名:withOverriddenContext

Query.withOverriddenContext介绍

暂无

代码示例

代码示例来源:origin: io.druid/druid-processing

public static <T> Query<T> withDefaultTimeout(Query<T> query, long defaultTimeout)
{
 return query.withOverriddenContext(ImmutableMap.of(QueryContexts.DEFAULT_TIMEOUT_KEY, defaultTimeout));
}

代码示例来源:origin: io.druid/druid-processing

public static <T> Query<T> withTimeout(Query<T> query, long timeout)
{
 return query.withOverriddenContext(ImmutableMap.of(TIMEOUT_KEY, timeout));
}

代码示例来源:origin: io.druid/druid-server

private static Query<?> readQuery(
  final HttpServletRequest req,
  final InputStream in,
  final ResponseContext context
) throws IOException
{
 Query baseQuery = context.getObjectMapper().readValue(in, Query.class);
 String prevEtag = getPreviousEtag(req);
 if (prevEtag != null) {
  baseQuery = baseQuery.withOverriddenContext(
    ImmutableMap.of(HEADER_IF_NONE_MATCH, prevEtag)
  );
 }
 return baseQuery;
}

代码示例来源:origin: io.druid/druid-processing

public static <T> Query<T> withMaxScatterGatherBytes(Query<T> query, long maxScatterGatherBytesLimit)
{
 Object obj = query.getContextValue(MAX_SCATTER_GATHER_BYTES_KEY);
 if (obj == null) {
  return query.withOverriddenContext(ImmutableMap.of(MAX_SCATTER_GATHER_BYTES_KEY, maxScatterGatherBytesLimit));
 } else {
  long curr = ((Number) obj).longValue();
  if (curr > maxScatterGatherBytesLimit) {
   throw new IAE(
     "configured [%s = %s] is more than enforced limit of [%s].",
     MAX_SCATTER_GATHER_BYTES_KEY,
     curr,
     maxScatterGatherBytesLimit
   );
  } else {
   return query;
  }
 }
}

代码示例来源:origin: io.druid/druid-server

public <T, QueryType extends Query<T>> QueryType withTimeoutAndMaxScatterGatherBytes(
   final QueryType query,
   ServerConfig serverConfig
 )
 {
  Query<T> newQuery = QueryContexts.verifyMaxQueryTimeout(
    QueryContexts.withMaxScatterGatherBytes(
      QueryContexts.withDefaultTimeout(
        (Query) query,
        Math.min(serverConfig.getDefaultQueryTimeout(), serverConfig.getMaxQueryTimeout())
      ),
      serverConfig.getMaxScatterGatherBytes()
    ),
    serverConfig.getMaxQueryTimeout()
  );
  return (QueryType) newQuery.withOverriddenContext(ImmutableMap.of(DirectDruidClient.QUERY_FAIL_TIME, this.startTimeMillis + QueryContexts.getTimeout(newQuery)));
 }
}

代码示例来源:origin: io.druid/druid-processing

subquery = (GroupByQuery) ((QueryDataSource) dataSource).getQuery().withOverriddenContext(subqueryContext);

代码示例来源:origin: io.druid/druid-server

SpecificQueryRunnable(final QueryPlus<T> queryPlus, final Map<String, Object> responseContext)
{
 this.queryPlus = queryPlus;
 this.responseContext = responseContext;
 this.query = queryPlus.getQuery();
 this.toolChest = warehouse.getToolChest(query);
 this.strategy = toolChest.getCacheStrategy(query);
 this.useCache = CacheUtil.useCacheOnBrokers(query, strategy, cacheConfig);
 this.populateCache = CacheUtil.populateCacheOnBrokers(query, strategy, cacheConfig);
 this.isBySegment = QueryContexts.isBySegment(query);
 // Note that enabling this leads to putting uncovered intervals information in the response headers
 // and might blow up in some cases https://github.com/druid-io/druid/issues/2108
 this.uncoveredIntervalsLimit = QueryContexts.getUncoveredIntervalsLimit(query);
 this.downstreamQuery = query.withOverriddenContext(makeDownstreamQueryContext());
}

代码示例来源:origin: com.n3twork.druid/druid-server

final Query<T> rewrittenQuery = query.withOverriddenContext(contextBuilder.build());

代码示例来源:origin: com.n3twork.druid/druid-processing

queryToRun = query.withOverriddenContext(ImmutableMap.<String, Object>of("finalize", false));
metricManipulationFn = MetricManipulatorFns.finalizing();

代码示例来源:origin: io.druid/druid-processing

queryToRun = query.withOverriddenContext(ImmutableMap.<String, Object>of("finalize", false));
metricManipulationFn = MetricManipulatorFns.finalizing();

相关文章