Initial query rewrite support.

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

Is this if no dataset is found in one secondary, or all secondaries?   Please add ScalaDoc to clarify.