Add support for aggregation functions

patch by blerer; reviewed by slebresne for CASSANDRA-4914