use of com.yahoo.elide.datastores.aggregation.queryengines.sql.query.SQLTimeDimensionProjection in project elide by yahoo.
the class DailyAverageScorePerPeriod method resolve.
@Override
public QueryPlan resolve(Query query) {
SQLTable table = (SQLTable) query.getSource();
MetricProjection innerMetric = table.getMetricProjection("highScore");
TimeDimension innerTimeGrain = table.getTimeDimension("recordedDate");
Map<String, Argument> arguments = new HashMap<>();
arguments.put("grain", Argument.builder().name("grain").value(TimeGrain.DAY).build());
QueryPlan innerQuery = QueryPlan.builder().source(query.getSource()).metricProjection(innerMetric).timeDimensionProjection(new SQLTimeDimensionProjection(innerTimeGrain, innerTimeGrain.getTimezone(), "recordedDate_DAY", arguments, true)).build();
QueryPlan outerQuery = QueryPlan.builder().source(innerQuery).metricProjection(new DailyAverageScorePerPeriod(this, "AVG({{$highScore}})")).build();
return outerQuery;
}
Aggregations