Initial query rewrite support.

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

Yeah... what Robert said.  I think using classOf[QueryRewriter] but it is the "safest" pattern, even if the class is final swapping back and forth is unnecessarily confusing.  You can write code to detect the proper thing automatically, just not in one line.