Package org.apache.calcite.materialize
Class MaterializationService
java.lang.Object
org.apache.calcite.materialize.MaterializationService
Manages the collection of materialized tables known to the system,
 and the process by which they become valid and invalid.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classDefault implementation ofMaterializationService.TableFactory.static interfaceCreates tables that represent a materialized view.
- 
Method SummaryModifier and TypeMethodDescription@Nullable CalciteSchema.TableEntryChecks whether a materialization is valid, and if so, returns the table where the data are stored.voidclear()De-registers all materialized tables in the system.@Nullable MaterializationKeydefineMaterialization(CalciteSchema schema, @Nullable TileKey tileKey, String viewSql, @Nullable List<String> viewSchemaPath, @Nullable String suggestedTableName, boolean create, boolean existing) Defines a new materialization.@Nullable MaterializationKeydefineMaterialization(CalciteSchema schema, @Nullable TileKey tileKey, String viewSql, @Nullable List<String> viewSchemaPath, @Nullable String suggestedTableName, MaterializationService.TableFactory tableFactory, boolean create, boolean existing) Defines a new materialization.@Nullable Pair<CalciteSchema.TableEntry,TileKey> defineTile(Lattice lattice, ImmutableBitSet groupSet, List<Lattice.Measure> measureList, CalciteSchema schema, boolean create, boolean exact) Defines a tile.@Nullable Pair<CalciteSchema.TableEntry,TileKey> defineTile(Lattice lattice, ImmutableBitSet groupSet, List<Lattice.Measure> measureList, CalciteSchema schema, boolean create, boolean exact, String suggestedTableName, MaterializationService.TableFactory tableFactory) static MaterializationServiceinstance()Returns the instance of the materialization service.query(CalciteSchema rootSchema) Gathers a list of all materialized tables known within a given root schema.voidstatic voidUsed by tests, to ensure that they see their own service.
- 
Method Details- 
defineMaterializationpublic @Nullable MaterializationKey defineMaterialization(CalciteSchema schema, @Nullable TileKey tileKey, String viewSql, @Nullable List<String> viewSchemaPath, @Nullable String suggestedTableName, boolean create, boolean existing) Defines a new materialization. Returns its key.
- 
defineMaterializationpublic @Nullable MaterializationKey defineMaterialization(CalciteSchema schema, @Nullable TileKey tileKey, String viewSql, @Nullable List<String> viewSchemaPath, @Nullable String suggestedTableName, MaterializationService.TableFactory tableFactory, boolean create, boolean existing) Defines a new materialization. Returns its key.
- 
checkValidChecks whether a materialization is valid, and if so, returns the table where the data are stored.
- 
defineTilepublic @Nullable Pair<CalciteSchema.TableEntry,TileKey> defineTile(Lattice lattice, ImmutableBitSet groupSet, List<Lattice.Measure> measureList, CalciteSchema schema, boolean create, boolean exact) Defines a tile.Setting the createflag to false prevents a materialization from being created if one does not exist. Critically, it is set to false during the recursive SQL that populates a materialization. Otherwise a materialization would try to create itself to populate itself!
- 
defineTilepublic @Nullable Pair<CalciteSchema.TableEntry,TileKey> defineTile(Lattice lattice, ImmutableBitSet groupSet, List<Lattice.Measure> measureList, CalciteSchema schema, boolean create, boolean exact, String suggestedTableName, MaterializationService.TableFactory tableFactory) 
- 
queryGathers a list of all materialized tables known within a given root schema. (Each root schema defines a disconnected namespace, with no overlap with the current schema. Especially in a test run, the contents of two root schemas may look similar.)
- 
clearpublic void clear()De-registers all materialized tables in the system.
- 
setThreadLocalpublic static void setThreadLocal()Used by tests, to ensure that they see their own service.
- 
instanceReturns the instance of the materialization service. Usually the global one, but returns a thread-local one during testing (whensetThreadLocal()has been called by the current thread).
- 
removeMaterialization
 
-