Not all query rewrites are performed by the Query Rewrite subsystem. Some, such as the Partial GROUP BY optimization (see Partial GROUP BY Block Optimization), are performed as late in the optimization process as join planning.
The topics that follow briefly describe some of the rewrites and the parse tree transformations that are done by the Optimizer after the Query Rewrite subsystem has completed its tasks.