Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Currently the way to get materialized views is via MaterializationService, but it would be simpler to get them from a new method Schema.getMaterializedViews().
Some thoughts:
- The method should return materialized views not just in the current schema, and therefore
- The method should be filtered by Table (or Tables)
- The objects returned can not include RelNode (RelNode can only be created in the context of a statement, and the Schema is created before the first statement; furthermore, holding onto RelNode would be a resource leak). But they should provide the means to create a RelNode (given sufficient context).
- Maybe the objects returned indicate something about the mapping
Taking all this, we get
List<Foo> getMaterializedViews(Table... tables); class Foo { public final Table view; public final List<Table> referencedTables; public final TileKey tileKey; // may be null public final String sql; // may be null; for information only public RelNode rel(Context context); }
Maybe we can obsolete CalciteSchema.getTableBySql.
Cc maryannxue, jamestaylor.