Add query rewrite support for where, group by and nested expressions.

You are correct, I was confused.