Sample custom aggregate function