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

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

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

Query.getContextValue介绍

暂无

代码示例

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

public static <T> String getChunkPeriod(Query<T> query)
{
 return query.getContextValue(CHUNK_PERIOD_KEY, "P0D");
}

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

static <T> long parseLong(Query<T> query, String key, long defaultValue)
{
 Object val = query.getContextValue(key);
 if (val == null) {
  return defaultValue;
 }
 if (val instanceof String) {
  return Long.parseLong((String) val);
 } else if (val instanceof Number) {
  return ((Number) val).longValue();
 } else {
  throw new ISE("Unknown type [%s]", val.getClass());
 }
}

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

static <T> int parseInt(Query<T> query, String key, int defaultValue)
{
 Object val = query.getContextValue(key);
 if (val == null) {
  return defaultValue;
 }
 if (val instanceof String) {
  return Integer.parseInt((String) val);
 } else if (val instanceof Number) {
  return ((Number) val).intValue();
 } else {
  throw new ISE("Unknown type [%s]", val.getClass());
 }
}

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

static <T> boolean parseBoolean(Query<T> query, String key, boolean defaultValue)
 {
  Object val = query.getContextValue(key);
  if (val == null) {
   return defaultValue;
  }
  if (val instanceof String) {
   return Boolean.parseBoolean((String) val);
  } else if (val instanceof Boolean) {
   return (boolean) val;
  } else {
   throw new ISE("Unknown type [%s]. Cannot parse!", val.getClass());
  }
 }
}

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

@Override
 public Sequence<Row> run(Query<Row> input)
 {
  if (Boolean.valueOf((String) input.getContextValue(GROUP_BY_MERGE_KEY, "true"))) {
   return mergeGroupByResults(((GroupByQuery) input).withOverriddenContext(NO_MERGE_CONTEXT), runner);
  } else {
   return runner.run(input);
  }
 }
};

代码示例来源: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

private <T> QueryRunner<T> makeRunner(Query<T> query, QueryRunner<T> baseClientRunner)
{
 QueryToolChest<T, Query<T>> toolChest = warehouse.getToolChest(query);
 PostProcessingOperator<T> postProcessing = objectMapper.convertValue(
   query.<String>getContextValue("postProcessing"),
   new TypeReference<PostProcessingOperator<T>>()
   {
   }
 );
 return new FluentQueryRunnerBuilder<>(toolChest)
   .create(
     new SetAndVerifyContextQueryRunner(
       serverConfig,
       new RetryQueryRunner<>(
         baseClientRunner,
         retryConfig,
         objectMapper
       )
     )
   )
   .applyPreMergeDecoration()
   .mergeResults()
   .applyPostMergeDecoration()
   .emitCPUTimeMetric(emitter)
   .postProcess(postProcessing);
}

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

long timeoutAt = query.getContextValue(QUERY_FAIL_TIME);
long maxScatterGatherBytes = QueryContexts.getMaxScatterGatherBytes(query);
AtomicLong totalBytesGathered = (AtomicLong) context.get(QUERY_TOTAL_BYTES_GATHERED);

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

final boolean skipIncrementalSegment = query.getContextValue(CONTEXT_SKIP_INCREMENTAL_SEGMENT, false);
final AtomicLong cpuTimeAccumulator = new AtomicLong(0L);

相关文章