Initial query rewrite support.

Currently supports matching columns, literals and count(*) in the selection
and columns in grouping.


We aren't returning any mismatches... we could log them all, but it is a bit of a marginal use case it seems.

At some point it may make sense to short circuit evaluation, but it isn't worth making the code more complicated.  That said, this chain will probably change as more parts of the query get rewritten, and I'm not sure if it will be able to stay a simple "look at one part at a time" path or not so I don't want to put too much into that yet.