To do the optimization properly, one needs to build up an execution plan and be able to track how columns change. Otherwise, we can't push down filters etc.