Search in sources :

Example 1 with MaterializationKey

use of org.apache.calcite.materialize.MaterializationKey in project calcite by apache.

the class SqlDropMaterializedView method execute.

@Override
public void execute(CalcitePrepare.Context context) {
    final Pair<CalciteSchema, String> pair = SqlDdlNodes.schema(context, true, name);
    final Table table = pair.left.plus().getTable(pair.right);
    if (table != null) {
        // Materialized view exists.
        super.execute(context);
        if (table instanceof Wrapper) {
            final MaterializationKey materializationKey = ((Wrapper) table).unwrap(MaterializationKey.class);
            if (materializationKey != null) {
                MaterializationService.instance().removeMaterialization(materializationKey);
            }
        }
    }
}
Also used : Wrapper(org.apache.calcite.schema.Wrapper) Table(org.apache.calcite.schema.Table) MaterializationKey(org.apache.calcite.materialize.MaterializationKey) CalciteSchema(org.apache.calcite.jdbc.CalciteSchema)

Aggregations

CalciteSchema (org.apache.calcite.jdbc.CalciteSchema)1 MaterializationKey (org.apache.calcite.materialize.MaterializationKey)1 Table (org.apache.calcite.schema.Table)1 Wrapper (org.apache.calcite.schema.Wrapper)1