call.transformTo(rel);
}
private static AggregateCall rollUp(AggregateCall aggregateCall,
MaterializationService.TileKey tileKey) {
final Aggregation aggregation = aggregateCall.getAggregation();
final Pair<Aggregation, List<Integer>> seek =
Pair.of(aggregation, aggregateCall.getArgList());
final int offset = tileKey.dimensions.cardinality();
final ImmutableList<Lattice.Measure> measures = tileKey.measures;
// First, try to satisfy the aggregation by rolling up an aggregate in the
// materialization.
final int i = find(measures, seek);
tryRoll:
if (i >= 0) {
final Aggregation roll = SubstitutionVisitor.getRollup(aggregation);
if (roll == null) {
break tryRoll;
}
return new AggregateCall(roll, false, ImmutableList.of(offset + i),
aggregateCall.type, aggregateCall.name);