add default implementations to QueryToolChest methods

This commit is contained in:
xvrl 2013-02-11 16:51:40 -08:00
parent e10025c841
commit e9f546c4ca
7 changed files with 12 additions and 75 deletions

View File

@ -48,9 +48,18 @@ public abstract class QueryToolChest<ResultType, QueryType extends Query<ResultT
public abstract ServiceMetricEvent.Builder makeMetricBuilder(QueryType query); public abstract ServiceMetricEvent.Builder makeMetricBuilder(QueryType query);
public abstract Function<ResultType, ResultType> makeMetricManipulatorFn(QueryType query, MetricManipulationFn fn); public abstract Function<ResultType, ResultType> makeMetricManipulatorFn(QueryType query, MetricManipulationFn fn);
public abstract TypeReference<ResultType> getResultTypeReference(); public abstract TypeReference<ResultType> getResultTypeReference();
public abstract <T> CacheStrategy<ResultType, T, QueryType> getCacheStrategy(QueryType query);
public abstract QueryRunner<ResultType> preMergeQueryDecoration(QueryRunner<ResultType> runner); public <T> CacheStrategy<ResultType, T, QueryType> getCacheStrategy(QueryType query) {
public abstract QueryRunner<ResultType> postMergeQueryDecoration(QueryRunner<ResultType> runner); return null;
}
public QueryRunner<ResultType> preMergeQueryDecoration(QueryRunner<ResultType> runner) {
return runner;
}
public QueryRunner<ResultType> postMergeQueryDecoration(QueryRunner<ResultType> runner) {
return runner;
}
public Iterable<SegmentDescriptor> filterSegments(QueryType query, Iterable<SegmentDescriptor> intervals) { public Iterable<SegmentDescriptor> filterSegments(QueryType query, Iterable<SegmentDescriptor> intervals) {
return intervals; return intervals;

View File

@ -176,22 +176,4 @@ public class GroupByQueryQueryToolChest extends QueryToolChest<Row, GroupByQuery
{ {
return TYPE_REFERENCE; return TYPE_REFERENCE;
} }
@Override
public CacheStrategy<Row, Object, GroupByQuery> getCacheStrategy(GroupByQuery query)
{
return null;
}
@Override
public QueryRunner<Row> preMergeQueryDecoration(QueryRunner<Row> runner)
{
return runner;
}
@Override
public QueryRunner<Row> postMergeQueryDecoration(QueryRunner<Row> runner)
{
return runner;
}
} }

View File

@ -219,18 +219,6 @@ public class SegmentMetadataQueryQueryToolChest extends QueryToolChest<SegmentAn
}; };
} }
@Override
public QueryRunner<SegmentAnalysis> preMergeQueryDecoration(QueryRunner<SegmentAnalysis> runner)
{
return runner;
}
@Override
public QueryRunner<SegmentAnalysis> postMergeQueryDecoration(QueryRunner<SegmentAnalysis> runner)
{
return runner;
}
private Ordering<SegmentAnalysis> getOrdering() private Ordering<SegmentAnalysis> getOrdering()
{ {
return new Ordering<SegmentAnalysis>() return new Ordering<SegmentAnalysis>()

View File

@ -262,12 +262,6 @@ public class SearchQueryQueryToolChest extends QueryToolChest<Result<SearchResul
); );
} }
@Override
public QueryRunner<Result<SearchResultValue>> postMergeQueryDecoration(final QueryRunner<Result<SearchResultValue>> runner)
{
return runner;
}
private static class SearchThresholdAdjustingQueryRunner implements QueryRunner<Result<SearchResultValue>> private static class SearchThresholdAdjustingQueryRunner implements QueryRunner<Result<SearchResultValue>>
{ {
private final QueryRunner<Result<SearchResultValue>> runner; private final QueryRunner<Result<SearchResultValue>> runner;

View File

@ -215,18 +215,6 @@ public class TimeBoundaryQueryQueryToolChest
}; };
} }
@Override
public QueryRunner<Result<TimeBoundaryResultValue>> preMergeQueryDecoration(QueryRunner<Result<TimeBoundaryResultValue>> runner)
{
return runner;
}
@Override
public QueryRunner<Result<TimeBoundaryResultValue>> postMergeQueryDecoration(QueryRunner<Result<TimeBoundaryResultValue>> runner)
{
return runner;
}
public Ordering<Result<TimeBoundaryResultValue>> getOrdering() public Ordering<Result<TimeBoundaryResultValue>> getOrdering()
{ {
return Ordering.natural(); return Ordering.natural();

View File

@ -258,12 +258,6 @@ public class TimeseriesQueryQueryToolChest extends QueryToolChest<Result<Timeser
return new IntervalChunkingQueryRunner<Result<TimeseriesResultValue>>(runner, Period.months(1)); return new IntervalChunkingQueryRunner<Result<TimeseriesResultValue>>(runner, Period.months(1));
} }
@Override
public QueryRunner<Result<TimeseriesResultValue>> postMergeQueryDecoration(QueryRunner<Result<TimeseriesResultValue>> runner)
{
return runner;
}
public Ordering<Result<TimeseriesResultValue>> getOrdering() public Ordering<Result<TimeseriesResultValue>> getOrdering()
{ {
return Ordering.natural(); return Ordering.natural();

View File

@ -422,23 +422,5 @@ public class ServerManagerTest
{ {
return new TypeReference<T>(){}; return new TypeReference<T>(){};
} }
@Override
public <Typer> CacheStrategy<T, Typer, QueryType> getCacheStrategy(QueryType query)
{
return null;
}
@Override
public QueryRunner<T> preMergeQueryDecoration(QueryRunner<T> runner)
{
return runner;
}
@Override
public QueryRunner<T> postMergeQueryDecoration(QueryRunner<T> runner)
{
return runner;
}
} }
} }