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

You don't need the `_ @ ( )` no?   Couldn't you just do `case SoQLFunctions.Max | SoQLFunctions.Min =>` ?