DATAGRAPH-345 : Add support for countBy projections on derived query

@jexp : Initial version of DATAGRAPH-345 code