Java Code Examples for org.apache.calcite.config.CalciteConnectionConfig#createMaterializations()

The following examples show how to use org.apache.calcite.config.CalciteConnectionConfig#createMaterializations() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RelOptLattice.java    From Bats with Apache License 2.0 3 votes vote down vote up
/** 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);
}
 
Example 2
Source File: RelOptLattice.java    From calcite with Apache License 2.0 3 votes vote down vote up
/** 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);
}