public class GroupByQueryQueryToolChest extends QueryToolChest<Row,GroupByQuery>
Modifier and Type | Field and Description |
---|---|
static String |
GROUP_BY_MERGE_KEY |
Constructor and Description |
---|
GroupByQueryQueryToolChest(GroupByStrategySelector strategySelector,
IntervalChunkingQueryRunnerDecorator intervalChunkingQueryRunnerDecorator) |
Modifier and Type | Method and Description |
---|---|
static Collection<DimensionSpec> |
extractionsToRewrite(GroupByQuery query)
This function checks the query for dimensions which can be optimized by applying the dimension extraction
as the final step of the query instead of on every event.
|
CacheStrategy<Row,Object,GroupByQuery> |
getCacheStrategy(GroupByQuery 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<Row> |
getResultTypeReference()
Returns a TypeReference object that is just passed through to Jackson in order to deserialize
the results of this type of query.
|
com.metamx.emitter.service.ServiceMetricEvent.Builder |
makeMetricBuilder(GroupByQuery query)
Creates a builder that is used to generate a metric for this specific query type.
|
com.google.common.base.Function<Row,Row> |
makePostComputeManipulatorFn(GroupByQuery query,
MetricManipulationFn fn)
Generally speaking this is the exact same thing as makePreComputeManipulatorFn.
|
com.google.common.base.Function<Row,Row> |
makePreComputeManipulatorFn(GroupByQuery 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<Row> |
mergeResults(QueryRunner<Row> runner)
This method wraps a QueryRunner.
|
QueryRunner<Row> |
preMergeQueryDecoration(QueryRunner<Row> runner)
Wraps a QueryRunner.
|
filterSegments, postMergeQueryDecoration
public static final String GROUP_BY_MERGE_KEY
@Inject public GroupByQueryQueryToolChest(GroupByStrategySelector strategySelector, IntervalChunkingQueryRunnerDecorator intervalChunkingQueryRunnerDecorator)
public QueryRunner<Row> mergeResults(QueryRunner<Row> runner)
QueryToolChest
mergeResults
in class QueryToolChest<Row,GroupByQuery>
runner
- A QueryRunner that provides a series of ResultType objects in time order (ascending or descending)public com.metamx.emitter.service.ServiceMetricEvent.Builder makeMetricBuilder(GroupByQuery query)
QueryToolChest
makeMetricBuilder
in class QueryToolChest<Row,GroupByQuery>
query
- The query that is being processedpublic com.google.common.base.Function<Row,Row> makePreComputeManipulatorFn(GroupByQuery 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<Row,GroupByQuery>
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<Row,Row> makePostComputeManipulatorFn(GroupByQuery query, MetricManipulationFn fn)
QueryToolChest
This should never actually be overridden and it should be removed as quickly as possible.
makePostComputeManipulatorFn
in class QueryToolChest<Row,GroupByQuery>
query
- The Query that is currently being processedfn
- The function that should be applied to all metrics in the resultspublic com.fasterxml.jackson.core.type.TypeReference<Row> getResultTypeReference()
QueryToolChest
getResultTypeReference
in class QueryToolChest<Row,GroupByQuery>
public QueryRunner<Row> preMergeQueryDecoration(QueryRunner<Row> 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<Row,GroupByQuery>
runner
- The runner to be wrappedpublic CacheStrategy<Row,Object,GroupByQuery> getCacheStrategy(GroupByQuery query)
QueryToolChest
This is optional. If it returns null, caching is effectively disabled for the query.
getCacheStrategy
in class QueryToolChest<Row,GroupByQuery>
query
- The query whose results might be cachedpublic static Collection<DimensionSpec> extractionsToRewrite(GroupByQuery query)
query
- The query to check for optimizationsCopyright © 2011–2017. All rights reserved.