public class SegmentMetadataQueryQueryToolChest extends QueryToolChest<SegmentAnalysis,SegmentMetadataQuery>
Constructor and Description |
---|
SegmentMetadataQueryQueryToolChest(SegmentMetadataQueryConfig config) |
SegmentMetadataQueryQueryToolChest(SegmentMetadataQueryConfig config,
GenericQueryMetricsFactory queryMetricsFactory) |
Modifier and Type | Method and Description |
---|---|
<T extends LogicalSegment> |
filterSegments(SegmentMetadataQuery query,
List<T> segments)
This method is called to allow the query to prune segments that it does not believe need to actually
be queried.
|
static SegmentAnalysis |
finalizeAnalysis(SegmentAnalysis analysis) |
CacheStrategy<SegmentAnalysis,SegmentAnalysis,SegmentMetadataQuery> |
getCacheStrategy(SegmentMetadataQuery query)
Returns a CacheStrategy to be used to load data into the cache and remove it from the cache.
|
SegmentMetadataQueryConfig |
getConfig() |
com.fasterxml.jackson.core.type.TypeReference<SegmentAnalysis> |
getResultTypeReference()
Returns a TypeReference object that is just passed through to Jackson in order to deserialize
the results of this type of query.
|
QueryMetrics<Query<?>> |
makeMetrics(SegmentMetadataQuery query)
Creates a
QueryMetrics object that is used to generate metrics for this specific query type. |
com.google.common.base.Function<SegmentAnalysis,SegmentAnalysis> |
makePreComputeManipulatorFn(SegmentMetadataQuery 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.
|
static SegmentAnalysis |
mergeAnalyses(SegmentAnalysis arg1,
SegmentAnalysis arg2,
boolean lenientAggregatorMerge) |
QueryRunner<SegmentAnalysis> |
mergeResults(QueryRunner<SegmentAnalysis> runner)
This method wraps a QueryRunner.
|
makePostComputeManipulatorFn, postMergeQueryDecoration, preMergeQueryDecoration
public SegmentMetadataQueryQueryToolChest(SegmentMetadataQueryConfig config)
@Inject public SegmentMetadataQueryQueryToolChest(SegmentMetadataQueryConfig config, GenericQueryMetricsFactory queryMetricsFactory)
public QueryRunner<SegmentAnalysis> mergeResults(QueryRunner<SegmentAnalysis> runner)
QueryToolChest
mergeResults
in class QueryToolChest<SegmentAnalysis,SegmentMetadataQuery>
runner
- A QueryRunner that provides a series of ResultType objects in time order (ascending or descending)public QueryMetrics<Query<?>> makeMetrics(SegmentMetadataQuery 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<SegmentAnalysis,SegmentMetadataQuery>
query
- The query that is being processedpublic com.google.common.base.Function<SegmentAnalysis,SegmentAnalysis> makePreComputeManipulatorFn(SegmentMetadataQuery 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<SegmentAnalysis,SegmentMetadataQuery>
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<SegmentAnalysis> getResultTypeReference()
QueryToolChest
getResultTypeReference
in class QueryToolChest<SegmentAnalysis,SegmentMetadataQuery>
public CacheStrategy<SegmentAnalysis,SegmentAnalysis,SegmentMetadataQuery> getCacheStrategy(SegmentMetadataQuery query)
QueryToolChest
This is optional. If it returns null, caching is effectively disabled for the query.
getCacheStrategy
in class QueryToolChest<SegmentAnalysis,SegmentMetadataQuery>
query
- The query whose results might be cachedpublic <T extends LogicalSegment> List<T> filterSegments(SegmentMetadataQuery query, List<T> segments)
QueryToolChest
filterSegments
in class QueryToolChest<SegmentAnalysis,SegmentMetadataQuery>
T
- A Generic parameter because Java is coolquery
- The query being processedsegments
- The list of candidate segments to be queriedpublic static SegmentAnalysis mergeAnalyses(SegmentAnalysis arg1, SegmentAnalysis arg2, boolean lenientAggregatorMerge)
public static SegmentAnalysis finalizeAnalysis(SegmentAnalysis analysis)
public SegmentMetadataQueryConfig getConfig()
Copyright © 2011–2018. All rights reserved.