Unable to update DLT-based materialized view if clustering key is missing

Malthe
Valued Contributor II

If we set up a materialized view with a clustering key, and then update the definition such that this key is no longer part of the table, Databricks complains:

Run ALTER TABLE ... CLUSTER BY ... to repair Delta clustering metadata.

But this is not possible and you can't do a full refresh either. One has to DROP the materialized view and recreate it (i.e. manual repair).

It should be possible to remedy this situation by doing a full refresh.