In current code, before matching query with materialized-view, unused fields of query is trimmed but materialized-view is not. Thus below simple SQL fails to be matched though query and materialized-
view are exactly the same:
Checking CalciteMaterializer https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/prepare/CalciteMaterializer.java#L83 , I think the code intends to do the trimming, but didn't call the method.
Since unused fields of query is trimmed anyway https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java#L995 , thus I think there's no necessity to keep the materialized-view un-trimmed