Original subject: "MaterializedViewAggregateRule should not rewrite top level name alias in project".
We use MaterializedViewAggregateRule to do optimize.
the original sql is :
after optimize, the sql is :
we expected it to be :
After examine the code , we found in rewriteView of MaterializedViewAggregateRule
when change it to true, everything goes as expected.
I think the rewrite rule should maintain then same type and name , not just type.
If it's true, we can come up with some modification and tests.