# Function - (Aggregate|Aggregation|Summary)

> Code - (Programming|Computer) Language > (Function | Operator | Map | Mapping | Transformation | Method | Rule | Task | Subroutine)

### Table of Contents

## 1 - About

Aggregate functions return a single value, calculated from values in a array.

## 2 - Articles Related

## 3 - List

Example of aggregate functions:

## 4 - Implementation

### 4.1 - Mutative operation

Mutative accumulation for a sum

int sum = 0; for (int x : numbers) { sum += x; }

### 4.2 - Reduction operation

They are implemented as reduction operation

### 4.3 - Partition

Some operations like AVG are not partitionable. It is not valid to compute them on partitioned data because they are not commutative and associative).

You can still compute partial aggregates by transforming the non-commutative and associative function by commutative and associative function and, then roll them up. For example if you want to compute AVG(x) you can expand to SUM(x) / COUNT(x), and compute partition SUM(x) and COUNT(X) on each partition then sum them using SUM.