use of org.apache.calcite.materialize.MaterializationService in project calcite by apache.
the class RelOptLattice method getAggregate.
/**
* Retrieves a materialized table that will satisfy an aggregate query on
* the star table.
*
* <p>The current implementation creates a materialization and populates it,
* provided that {@link Lattice#auto} is true.
*
* <p>Future implementations might return materializations at a different
* level of aggregation, from which the desired result can be obtained by
* rolling up.
*
* @param planner Current planner
* @param groupSet Grouping key
* @param measureList Calls to aggregate functions
* @return Materialized table
*/
public Pair<CalciteSchema.TableEntry, TileKey> getAggregate(RelOptPlanner planner, ImmutableBitSet groupSet, List<Lattice.Measure> measureList) {
final CalciteConnectionConfig config = planner.getContext().unwrap(CalciteConnectionConfig.class);
if (config == null) {
return null;
}
final MaterializationService service = MaterializationService.instance();
boolean create = lattice.auto && config.createMaterializations();
final CalciteSchema schema = starRelOptTable.unwrap(CalciteSchema.class);
return service.defineTile(lattice, groupSet, measureList, schema, create, false);
}
Aggregations