Using User-Defined Aggregate Functions
To perform this computation, the aggregate function AVG () goes through these steps: Initializes the computation by initializing the aggregation context, or the rows over which aggregation is performed: Copy runningSum = 0; runningCount = 0; Iteratively processes each successive input value and updates the context: Copy