Implement casts for more basic data types in QueryInterpreter.

Fixes issue #664. Test in AggregateTest.testGroupBy. Review by @cvogt