public class TimeseriesQueryQueryToolChest extends QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
Constructor and Description |
---|
TimeseriesQueryQueryToolChest(IntervalChunkingQueryRunnerDecorator intervalChunkingQueryRunnerDecorator) |
TimeseriesQueryQueryToolChest(IntervalChunkingQueryRunnerDecorator intervalChunkingQueryRunnerDecorator,
TimeseriesQueryMetricsFactory queryMetricsFactory) |
Modifier and Type | Method and Description |
---|---|
CacheStrategy<Result<TimeseriesResultValue>,Object,TimeseriesQuery> |
getCacheStrategy(TimeseriesQuery query)
Returns a CacheStrategy to be used to load data into the cache and remove it from the cache.
|
com.fasterxml.jackson.core.type.TypeReference<Result<TimeseriesResultValue>> |
getResultTypeReference()
Returns a TypeReference object that is just passed through to Jackson in order to deserialize
the results of this type of query.
|
TimeseriesQueryMetrics |
makeMetrics(TimeseriesQuery query)
Creates a
QueryMetrics object that is used to generate metrics for this specific query type. |
com.google.common.base.Function<Result<TimeseriesResultValue>,Result<TimeseriesResultValue>> |
makePostComputeManipulatorFn(TimeseriesQuery query,
MetricManipulationFn fn)
Generally speaking this is the exact same thing as makePreComputeManipulatorFn.
|
com.google.common.base.Function<Result<TimeseriesResultValue>,Result<TimeseriesResultValue>> |
makePreComputeManipulatorFn(TimeseriesQuery query,
MetricManipulationFn fn)
Creates a Function that can take in a ResultType and return a new ResultType having applied
the MetricManipulatorFn to each of the metrics.
|
QueryRunner<Result<TimeseriesResultValue>> |
mergeResults(QueryRunner<Result<TimeseriesResultValue>> queryRunner)
This method wraps a QueryRunner.
|
QueryRunner<Result<TimeseriesResultValue>> |
preMergeQueryDecoration(QueryRunner<Result<TimeseriesResultValue>> runner)
Wraps a QueryRunner.
|
filterSegments, postMergeQueryDecoration
public TimeseriesQueryQueryToolChest(IntervalChunkingQueryRunnerDecorator intervalChunkingQueryRunnerDecorator)
@Inject public TimeseriesQueryQueryToolChest(IntervalChunkingQueryRunnerDecorator intervalChunkingQueryRunnerDecorator, TimeseriesQueryMetricsFactory queryMetricsFactory)
public QueryRunner<Result<TimeseriesResultValue>> mergeResults(QueryRunner<Result<TimeseriesResultValue>> queryRunner)
QueryToolChest
mergeResults
in class QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
queryRunner
- A QueryRunner that provides a series of ResultType objects in time order (ascending or descending)public TimeseriesQueryMetrics makeMetrics(TimeseriesQuery query)
QueryToolChest
QueryMetrics
object that is used to generate metrics for this specific query type. This exists
to allow for query-specific dimensions and metrics. That is, the ToolChest is expected to set some
meaningful dimensions for metrics given this query type. Examples might be the topN threshold for
a TopN query or the number of dimensions included for a groupBy query.
QueryToolChests for query types in core (druid-processing) and public extensions (belonging to the Druid source
tree) should use delegate this method to GenericQueryMetricsFactory.makeMetrics(Query)
on an injected
instance of GenericQueryMetricsFactory
, as long as they don't need to emit custom dimensions and/or
metrics.
If some custom dimensions and/or metrics should be emitted for a query type, a plan described in
"Making subinterfaces of QueryMetrics" section in QueryMetrics
's class-level Javadocs should be followed.
One way or another, this method should ensure that QueryMetrics.query(Query)
is called with the given
query passed on the created QueryMetrics object before returning.
makeMetrics
in class QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
query
- The query that is being processedpublic com.fasterxml.jackson.core.type.TypeReference<Result<TimeseriesResultValue>> getResultTypeReference()
QueryToolChest
getResultTypeReference
in class QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
public CacheStrategy<Result<TimeseriesResultValue>,Object,TimeseriesQuery> getCacheStrategy(TimeseriesQuery query)
QueryToolChest
This is optional. If it returns null, caching is effectively disabled for the query.
getCacheStrategy
in class QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
query
- The query whose results might be cachedpublic QueryRunner<Result<TimeseriesResultValue>> preMergeQueryDecoration(QueryRunner<Result<TimeseriesResultValue>> runner)
QueryToolChest
In fact, the return value of this method is always passed to mergeResults, so it is equivalent to just implement this functionality as extra decoration on the QueryRunner during mergeResults().
In the interests of potentially simplifying these interfaces, the recommendation is to actually not override this method and instead apply anything that might be needed here in the mergeResults() call.
preMergeQueryDecoration
in class QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
runner
- The runner to be wrappedpublic com.google.common.base.Function<Result<TimeseriesResultValue>,Result<TimeseriesResultValue>> makePreComputeManipulatorFn(TimeseriesQuery query, MetricManipulationFn fn)
QueryToolChest
This exists because the QueryToolChest is the only thing that understands the internal serialization format of ResultType, so it's primary responsibility is to "decompose" that structure and apply the given function to all metrics.
This function is called very early in the processing pipeline on the Broker.
makePreComputeManipulatorFn
in class QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
query
- The Query that is currently being processedfn
- The function that should be applied to all metrics in the resultspublic com.google.common.base.Function<Result<TimeseriesResultValue>,Result<TimeseriesResultValue>> makePostComputeManipulatorFn(TimeseriesQuery query, MetricManipulationFn fn)
QueryToolChest
This should never actually be overridden and it should be removed as quickly as possible.
makePostComputeManipulatorFn
in class QueryToolChest<Result<TimeseriesResultValue>,TimeseriesQuery>
query
- The Query that is currently being processedfn
- The function that should be applied to all metrics in the resultsCopyright © 2011–2018. All rights reserved.