User-defined functions and aggregates

Cassandra 2.2 introduced user-defined functions (UDF) and aggregates support. You access UDF and aggregate values in your queries like regular columns:

const query = 'SELECT avg(salary) as salary FROM employees';
  .then(function (result) {
    const row = result.first();
    console.log('Average salary %d', row.salary); 

The driver also exposes UDFs and aggregates metadata information, for example let’s see how to retrieve the metadata information of a UDF named iif, that takes a boolean and int parameter.

client.metadata.getFunction('ks1', 'iif', ['boolean', 'int'])
  .then(function (err, udf) {
    console.log('Function metadata %j', udf);