org.apache.druid.query.Query.getId()方法的使用及代码示例

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

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

Query.getId介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-druid

@Override
public String getId()
{
 return query.getId();
}

代码示例来源:origin: apache/incubator-druid

private String extractEtagFromResults(
  final byte[] cachedResult
)
{
 if (cachedResult == null) {
  return null;
 }
 log.debug("Fetching result level cache identifier for query: %s", query.getId());
 int etagLength = ByteBuffer.wrap(cachedResult, 0, Integer.BYTES).getInt();
 return StringUtils.fromUtf8(Arrays.copyOfRange(cachedResult, Integer.BYTES, etagLength + Integer.BYTES));
}

代码示例来源:origin: apache/incubator-druid

@Override
public void exceptionCaught(final ClientResponse<InputStream> clientResponse, final Throwable e)
{
 String msg = StringUtils.format(
   "Query[%s] url[%s] failed with exception msg [%s]",
   query.getId(),
   url,
   e.getMessage()
 );
 setupResponseReadFailure(msg, e);
}

代码示例来源:origin: apache/incubator-druid

@Override
public void queryId(QueryType query)
{
 setDimension(DruidMetrics.ID, StringUtils.nullToEmptyNonDruidDataString(query.getId()));
}

代码示例来源:origin: apache/incubator-druid

/**
 * Initializes this object to execute a specific query. Does not actually execute the query.
 *
 * @param baseQuery the query
 */
@SuppressWarnings("unchecked")
public void initialize(final Query baseQuery)
{
 transition(State.NEW, State.INITIALIZED);
 String queryId = baseQuery.getId();
 if (Strings.isNullOrEmpty(queryId)) {
  queryId = UUID.randomUUID().toString();
 }
 this.baseQuery = baseQuery.withId(queryId);
 this.toolChest = warehouse.getToolChest(baseQuery);
}

代码示例来源:origin: apache/incubator-druid

private void checkTotalBytesLimit(long bytes)
 {
  if (maxScatterGatherBytes < Long.MAX_VALUE && totalBytesGathered.addAndGet(bytes) > maxScatterGatherBytes) {
   String msg = StringUtils.format(
     "Query[%s] url[%s] max scatter-gather bytes limit reached.",
     query.getId(),
     url
   );
   setupResponseReadFailure(msg, null);
   throw new RE(msg);
  }
 }
};

代码示例来源:origin: apache/incubator-druid

private long checkQueryTimeout()
{
 long timeLeft = timeoutAt - System.currentTimeMillis();
 if (timeLeft <= 0) {
  String msg = StringUtils.format("Query[%s] url[%s] timed out.", query.getId(), url);
  setupResponseReadFailure(msg, null);
  throw new RE(msg);
 } else {
  return timeLeft;
 }
}

代码示例来源:origin: apache/incubator-druid

private InputStream dequeue() throws InterruptedException
{
 final InputStreamHolder holder = queue.poll(checkQueryTimeout(), TimeUnit.MILLISECONDS);
 if (holder == null) {
  throw new RE("Query[%s] url[%s] timed out.", query.getId(), url);
 }
 final long currentQueuedByteCount = queuedByteCount.addAndGet(-holder.getLength());
 if (usingBackpressure && currentQueuedByteCount < maxQueuedBytes) {
  long backPressureTime = Preconditions.checkNotNull(trafficCopRef.get(), "No TrafficCop, how can this be?")
                     .resume(holder.getChunkNum());
  channelSuspendedTime.addAndGet(backPressureTime);
 }
 return holder.getStream();
}

代码示例来源:origin: apache/incubator-druid

private ResultLevelCachePopulator createResultLevelCachePopulator(
  String cacheKeyStr,
  String resultSetId
)
{
 if (resultSetId != null && populateResultCache) {
  ResultLevelCachePopulator resultLevelCachePopulator = new ResultLevelCachePopulator(
    cache,
    objectMapper,
    ResultLevelCacheUtil.computeResultLevelCacheKey(cacheKeyStr),
    cacheConfig,
    true
  );
  try {
   //   Save the resultSetId and its length
   resultLevelCachePopulator.cacheObjectStream.write(ByteBuffer.allocate(Integer.BYTES)
                                 .putInt(resultSetId.length())
                                 .array());
   resultLevelCachePopulator.cacheObjectStream.write(StringUtils.toUtf8(resultSetId));
  }
  catch (IOException ioe) {
   log.error(ioe, "Failed to write cached values for query %s", query.getId());
   return null;
  }
  return resultLevelCachePopulator;
 } else {
  return null;
 }
}

代码示例来源:origin: apache/incubator-druid

log.debug(
  "Completed queryId[%s] request to url[%s] with %,d bytes returned in %,d millis [%,f b/s].",
  query.getId(),
  url,
  totalByteCount.get(),

代码示例来源:origin: apache/incubator-druid

try {
 final Query query = requestLogLine.getQuery();
 MDC.put("queryId", query.getId());
 MDC.put("sqlQueryId", StringUtils.nullToEmptyNonDruidDataString(query.getSqlQueryId()));
 MDC.put("dataSource", findInnerDatasource(query).toString());

代码示例来源:origin: apache/incubator-druid

new ResourceLimitExceededException(
   "query[%s] url[%s] timed out or max bytes limit reached.",
   query.getId(),
   url
 ),
e,
"Failure getting results for query[%s] url[%s] because of [%s]",
query == null ? null : query.getId(),
url,
e.getMessage()

代码示例来源:origin: apache/incubator-druid

@Override
public void registerQuery(Query query, final ListenableFuture future)
{
 final String id = query.getId();
 final List<String> datasources = query.getDataSource().getNames();
 queries.put(id, future);
 queryDatasources.putAll(id, datasources);
 future.addListener(
   new Runnable()
   {
    @Override
    public void run()
    {
     queries.remove(id, future);
     for (String datasource : datasources) {
      queryDatasources.remove(id, datasource);
     }
    }
   },
   Execs.directExecutor()
 );
}

代码示例来源:origin: apache/incubator-druid

private Sequence<T> deserializeResults(final byte[] cachedResult, CacheStrategy strategy, String resultSetId)
{
 if (cachedResult == null) {
  log.error("Cached result set is null");
 }
 final Function<Object, T> pullFromCacheFunction = strategy.pullFromCache(true);
 final TypeReference<Object> cacheObjectClazz = strategy.getCacheObjectClazz();
 //Skip the resultsetID and its length bytes
 Sequence<T> cachedSequence = Sequences.simple(() -> {
  try {
   int resultOffset = Integer.BYTES + resultSetId.length();
   return objectMapper.readValues(
     objectMapper.getFactory().createParser(
       cachedResult,
       resultOffset,
       cachedResult.length - resultOffset
     ),
     cacheObjectClazz
   );
  }
  catch (IOException e) {
   throw new RE(e, "Failed to retrieve results from cache for query ID [%s]", query.getId());
  }
 });
 return Sequences.map(cachedSequence, pullFromCacheFunction);
}

代码示例来源:origin: apache/incubator-druid

log.warn("Tried to emit logs and metrics twice for query[%s]!", baseQuery.getId());
  log.warn(e, "Exception while processing queryId [%s]", baseQuery.getId());
  statsMap.put("interrupted", true);
  statsMap.put("reason", e.toString());

代码示例来源:origin: apache/incubator-druid

if (inputQuery != null) {
 targetServer = hostFinder.pickServer(inputQuery);
 if (inputQuery.getId() == null) {
  inputQuery = inputQuery.withId(UUID.randomUUID().toString());

代码示例来源:origin: apache/incubator-druid

queryLifecycle.initialize(readQuery(req, in, context));
query = queryLifecycle.getQuery();
final String queryId = query.getId();

代码示例来源:origin: apache/incubator-druid

checkTotalBytesLimit(response.getContent().readableBytes());
log.debug("Initial response from url[%s] for queryId[%s]", url, query.getId());
responseStartTimeNs = System.nanoTime();
acquireResponseMetrics().reportNodeTimeToFirstByte(responseStartTimeNs - requestStartTimeNs).emit(emitter);

代码示例来源:origin: apache/incubator-druid

final String cancelUrl = StringUtils.format("%s://%s/druid/v2/%s", scheme, host, query.getId());
 log.debug("Querying queryId[%s] url[%s]", query.getId(), url);
  throw new RE("Query[%s] url[%s] timed out.", query.getId(), url);

代码示例来源:origin: apache/incubator-druid

log.debug("Return cached result set as there is no change in identifiers for query %s ", query.getId());
 return deserializeResults(cachedResultSet, strategy, existingResultSetId);
} else {

相关文章