You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/querying/pages/func/aggregation-functions.adoc
+15-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,14 @@ This page lists the aggregation functions available in the GSQL query language.
4
4
5
5
[NOTE]
6
6
====
7
-
The ``DISTINCT`` keyword can be used to include repeated values only once when aggregating.
7
+
If the ``DISTINCT`` option is used, then duplicate values are excluded.
8
+
By default, duplicate values are included.
9
+
10
+
Example:
11
+
12
+
``sum([2,2,2]) ``returns 6.
13
+
14
+
`sum(DISTINCT [2,2,2])` returns 2.
8
15
====
9
16
10
17
== avg()
@@ -18,6 +25,7 @@ The ``DISTINCT`` keyword can be used to include repeated values only once when a
18
25
=== Description
19
26
20
27
Returns the average of all elements in a set or bag. The function can only take set/bag expressions whose members are numeric types.
28
+
Returns 0 if the input set is empty.
21
29
22
30
[discrete]
23
31
=== Return type
@@ -55,6 +63,7 @@ avg([3, 2, 1]) -> 2
55
63
=== Description
56
64
57
65
Returns the size of the set or bag.
66
+
Returns 0 if the input set is empty.
58
67
59
68
[discrete]
60
69
=== Return type
@@ -92,6 +101,7 @@ count([1, 1, 2, 2) => 4
92
101
93
102
Returns the member with the maximum value in a set or bag.
94
103
The function can only take set/bag expressions whose members are numeric types.
104
+
Returns 0 if the input set is empty.
95
105
96
106
[discrete]
97
107
=== Return type
@@ -128,6 +138,7 @@ max([1, 1, 3, 3]) => 3
128
138
=== Description
129
139
130
140
Returns the member with the minimum value in a set or bag. The function can only take set/bag expressions whose members are numeric types.
141
+
Returns 0 if the input set is empty.
131
142
132
143
[discrete]
133
144
=== Return type
@@ -164,6 +175,7 @@ min([1, 1, 3, 3]) => 1
164
175
=== Description
165
176
166
177
Returns the standard deviation of all members in a set or bag, assuming the input is a sample.
178
+
Returns 0 if the input set is empty.
167
179
168
180
This function uses `N - 1` as the denominator, and should be used when taking a sample of the population for an unbiased estimate. When the standard variation of the entire population is being calculated, `stdevp` should be used.
Returns the standard deviation of all members in a set or bag, assuming the input is the population.
220
+
Returns 0 if the input set is empty.
208
221
209
222
This function uses `N` as the denominator, and should be used when calculating the standard deviation for an entire population. When the standard variation of only a sample of the population is being calculated, `stDev` should be used.
0 commit comments