Add support for SUM and AVG aggregate functions