Initial query rewrite support.

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

It would be helpful to have a brief ScalaDoc.  I can read the code and figure out it's for querying Secondaries, but easier to state that up front  :)