Hi, It looks like MaterializationTest heavily relies on inaccurate statistics for hr.emps and hr.depts tables.
I was trying to improve statistic estimation for better join planning (see https://github.com/apache/calcite/pull/1712 ), and it looks like better estimates open the eyes of the optimizer, and now it realizes it does not really need to use materialized view for 4-row long table. In other words, the cost of the table access is more-or-less the same as the cost of the materialized view access. It looks like the way to go here is to add hr_with_extra_rows scheme so it contains the same emps and depts tables, but it should have bigger tables. Adding rows to the existing emps table is not an option because it would invalidate lots of tests. Does anybody have better ideas? Vladimir