Package org.apache.druid.query
Class QueryPlus<T>
- java.lang.Object
-
- org.apache.druid.query.QueryPlus<T>
-
public final class QueryPlus<T> extends Object
An immutable composite object ofQuery+ extra stuff needed inQueryRunners.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Query<T>getQuery()QueryMetrics<?>getQueryMetrics()QueryPlus<T>optimizeForSegment(PerSegmentQueryOptimizationContext optimizationContext)Sequence<T>run(QuerySegmentWalker walker, ResponseContext context)<C extends Query<T>>
CunwrapQuery(Class<C> clazz)QueryPlus<T>withIdentity(String identity)Returns the same QueryPlus object with the identity replaced.QueryPlus<T>withMaxQueuedBytes(long maxQueuedBytes)Equivalent of withQuery(getQuery().withOverriddenContext(ImmutableMap.of(MAX_QUEUED_BYTES_KEY, maxQueuedBytes))).QueryPlus<T>withoutThreadUnsafeState()Returns a QueryPlus object without the components which are unsafe for concurrent use from multiple threads, therefore couldn't be passed down in concurrent or asyncQueryRunners.<U> QueryPlus<U>withQuery(Query<U> replacementQuery)Returns a QueryPlus object withQueryMetricsfrom this QueryPlus object, and the providedQuery.QueryPlus<T>withQueryMetrics(QueryToolChest<T,? extends Query<T>> queryToolChest)Returns the same QueryPlus object, if it already hasQueryMetrics(getQueryMetrics()returns not null), or returns a new QueryPlus object withQueryfrom this QueryPlus and QueryMetrics created using the givenQueryToolChest, viaQueryToolChest.makeMetrics(Query)method.static <T> QueryPlus<T>wrap(Query<T> query)Returns the minimum bare QueryPlus object with the given query.
-
-
-
Method Detail
-
wrap
public static <T> QueryPlus<T> wrap(Query<T> query)
Returns the minimum bare QueryPlus object with the given query.getQueryMetrics()of the QueryPlus object, returned from this factory method, returnsnull.
-
getQueryMetrics
@Nullable public QueryMetrics<?> getQueryMetrics()
-
withIdentity
public QueryPlus<T> withIdentity(String identity)
Returns the same QueryPlus object with the identity replaced. This new identity will affect future calls towithoutQueryMetrics()but will not affect any currently-existing queryMetrics.
-
withQueryMetrics
public QueryPlus<T> withQueryMetrics(QueryToolChest<T,? extends Query<T>> queryToolChest)
Returns the same QueryPlus object, if it already hasQueryMetrics(getQueryMetrics()returns not null), or returns a new QueryPlus object withQueryfrom this QueryPlus and QueryMetrics created using the givenQueryToolChest, viaQueryToolChest.makeMetrics(Query)method. By convention, callers ofwithQueryMetrics()must also call .getQueryMetrics().emit() on the returned QueryMetrics object, regardless if this object is the same as the object on which .withQueryMetrics() was initially called (i. e. it already had non-null QueryMetrics), or if it is a new QueryPlus object. SeeMetricsEmittingQueryRunnerfor example.
-
withoutThreadUnsafeState
public QueryPlus<T> withoutThreadUnsafeState()
Returns a QueryPlus object without the components which are unsafe for concurrent use from multiple threads, therefore couldn't be passed down in concurrent or asyncQueryRunners. Currently the only unsafe component isQueryMetrics, i. e.withoutThreadUnsafeState()call is equivalent towithoutQueryMetrics().
-
withMaxQueuedBytes
public QueryPlus<T> withMaxQueuedBytes(long maxQueuedBytes)
Equivalent of withQuery(getQuery().withOverriddenContext(ImmutableMap.of(MAX_QUEUED_BYTES_KEY, maxQueuedBytes))).
-
withQuery
public <U> QueryPlus<U> withQuery(Query<U> replacementQuery)
Returns a QueryPlus object withQueryMetricsfrom this QueryPlus object, and the providedQuery.
-
run
public Sequence<T> run(QuerySegmentWalker walker, ResponseContext context)
-
optimizeForSegment
public QueryPlus<T> optimizeForSegment(PerSegmentQueryOptimizationContext optimizationContext)
-
-