I have implemented user defined aggregate function average in my cassandra db as described in the link https://docs.datastax.com/en/dse/5.1/cql/cql