<s>
In	O
database	B-Application
management	I-Application
,	O
an	O
aggregate	O
function	O
or	O
aggregation	O
function	O
is	O
a	O
function	O
where	O
the	O
values	O
of	O
multiple	O
rows	O
are	O
grouped	O
together	O
to	O
form	O
a	O
single	O
summary	O
value	O
.	O
</s>
<s>
Formally	O
,	O
an	O
aggregate	O
function	O
takes	O
as	O
input	O
a	O
set	O
,	O
a	O
multiset	B-Application
(	O
bag	O
)	O
,	O
or	O
a	O
list	O
from	O
some	O
input	O
domain	O
and	O
outputs	O
an	O
element	O
of	O
an	O
output	O
domain	O
.	O
</s>
<s>
Aggregate	O
functions	O
occur	O
commonly	O
in	O
numerous	O
programming	O
languages	O
,	O
in	O
spreadsheets	B-Application
,	O
and	O
in	O
relational	B-Algorithm
algebra	I-Algorithm
.	O
</s>
<s>
In	O
the	O
entity	B-Architecture
relationship	I-Architecture
diagram	I-Architecture
,	O
aggregation	O
is	O
represented	O
as	O
seen	O
in	O
Figure	O
1	O
with	O
a	O
rectangle	O
around	O
the	O
relationship	O
and	O
its	O
entities	O
to	O
indicate	O
that	O
it	O
is	O
being	O
treated	O
as	O
an	O
aggregate	O
entity	O
.	O
</s>
<s>
In	O
distributed	B-Architecture
computing	I-Architecture
,	O
it	O
is	O
desirable	O
to	O
divide	O
such	O
computations	O
into	O
smaller	O
pieces	O
,	O
and	O
distribute	O
the	O
work	O
,	O
usually	O
computing	B-Operating_System
in	I-Operating_System
parallel	I-Operating_System
,	O
via	O
a	O
divide	B-Algorithm
and	I-Algorithm
conquer	I-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
In	O
other	O
cases	O
the	O
aggregate	O
can	O
be	O
computed	O
by	O
computing	O
auxiliary	O
numbers	O
for	O
subsets	O
,	O
aggregating	O
these	O
auxiliary	O
numbers	O
,	O
and	O
finally	O
computing	O
the	O
overall	O
number	O
at	O
the	O
end	O
;	O
examples	O
include	O
AVERAGE	O
(	O
tracking	O
sum	O
and	O
count	O
,	O
dividing	O
at	O
the	O
end	O
)	O
and	O
RANGE	B-General_Concept
(	O
tracking	O
max	O
and	O
min	O
,	O
subtracting	O
at	O
the	O
end	O
)	O
.	O
</s>
<s>
Such	O
functions	O
are	O
called	O
decomposable	B-Operating_System
aggregation	I-Operating_System
functions	I-Operating_System
or	O
decomposable	O
aggregate	O
functions	O
.	O
</s>
<s>
where	O
is	O
the	O
union	O
of	O
multisets	B-Application
(	O
see	O
monoid	O
homomorphism	O
)	O
.	O
</s>
<s>
More	O
generally	O
,	O
one	O
can	O
define	O
a	O
decomposable	B-Operating_System
aggregation	I-Operating_System
function	I-Operating_System
as	O
one	O
that	O
can	O
be	O
expressed	O
as	O
the	O
composition	O
of	O
a	O
final	O
function	O
and	O
a	O
self-decomposable	O
aggregation	O
function	O
,	O
.	O
</s>
<s>
For	O
example	O
,	O
AVERAGE	O
=	O
SUM/COUNT	O
and	O
RANGE	B-General_Concept
=	O
MAX−MIN	O
.	O
</s>
<s>
In	O
the	O
MapReduce	B-Operating_System
framework	O
,	O
these	O
steps	O
are	O
known	O
as	O
InitialReduce	O
(	O
value	O
on	O
individual	O
record/singleton	O
set	O
)	O
,	O
Combine	O
(	O
binary	O
merge	O
on	O
two	O
aggregations	O
)	O
,	O
and	O
FinalReduce	O
(	O
final	O
function	O
on	O
auxiliary	O
values	O
)	O
,	O
and	O
moving	O
decomposable	O
aggregation	O
before	O
the	O
Shuffle	O
phase	O
is	O
known	O
as	O
an	O
InitialReduce	O
step	O
,	O
</s>
<s>
Decomposable	B-Operating_System
aggregation	I-Operating_System
functions	I-Operating_System
are	O
important	O
in	O
online	B-Application
analytical	I-Application
processing	I-Application
(	O
OLAP	B-Application
)	O
,	O
as	O
they	O
allow	O
aggregation	O
queries	O
to	O
be	O
computed	O
on	O
the	O
pre-computed	O
results	O
in	O
the	O
OLAP	B-Application
cube	O
,	O
rather	O
than	O
on	O
the	O
base	O
data	O
.	O
</s>
<s>
For	O
example	O
,	O
it	O
is	O
easy	O
to	O
support	O
COUNT	O
,	O
MAX	O
,	O
MIN	O
,	O
and	O
SUM	O
in	O
OLAP	B-Application
,	O
since	O
these	O
can	O
be	O
computed	O
for	O
each	O
cell	O
of	O
the	O
OLAP	B-Application
cube	O
and	O
then	O
summarized	O
(	O
"	O
rolled	O
up	O
"	O
)	O
,	O
but	O
it	O
is	O
difficult	O
to	O
support	O
MEDIAN	O
,	O
as	O
that	O
must	O
be	O
computed	O
for	O
every	O
view	O
separately	O
.	O
</s>
<s>
In	O
order	O
to	O
calculate	O
the	O
average	O
and	O
standard	B-General_Concept
deviation	I-General_Concept
from	O
aggregate	O
data	O
,	O
it	O
is	O
necessary	O
to	O
have	O
available	O
for	O
each	O
group	O
:	O
the	O
total	O
of	O
values	O
( Σxi	O
=	O
SUM(x )	O
)	O
,	O
the	O
number	O
of	O
values	O
(	O
N	O
=	O
COUNT(x )	O
)	O
and	O
the	O
total	O
of	O
squares	O
of	O
the	O
values	O
( Σxi2	O
=	O
SUM(x2 )	O
)	O
of	O
each	O
groups	O
.	O
</s>
<s>
STDDEV	B-General_Concept
:	O
</s>
<s>
This	O
means	O
that	O
the	O
standard	B-General_Concept
deviation	I-General_Concept
is	O
equal	O
to	O
the	O
square	O
root	O
of	O
the	O
difference	O
between	O
the	O
average	O
of	O
the	O
squares	O
of	O
the	O
values	O
and	O
the	O
square	O
of	O
the	O
average	O
value	O
.	O
</s>
