Skip to content

Commit 9628343

Browse files
authored
Merge pull request #280 from tigergraph/DOC-2408-aggreg-func-value-when-empty
DOC-2408-aggreg-func-value-when-empty
2 parents 5fb2656 + 25fc8f8 commit 9628343

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

modules/querying/pages/func/aggregation-functions.adoc

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ This page lists the aggregation functions available in the GSQL query language.
44

55
[NOTE]
66
====
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.
815
====
916

1017
== avg()
@@ -18,6 +25,7 @@ The ``DISTINCT`` keyword can be used to include repeated values only once when a
1825
=== Description
1926

2027
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.
2129

2230
[discrete]
2331
=== Return type
@@ -55,6 +63,7 @@ avg([3, 2, 1]) -> 2
5563
=== Description
5664

5765
Returns the size of the set or bag.
66+
Returns 0 if the input set is empty.
5867

5968
[discrete]
6069
=== Return type
@@ -92,6 +101,7 @@ count([1, 1, 2, 2) => 4
92101

93102
Returns the member with the maximum value in a set or bag.
94103
The function can only take set/bag expressions whose members are numeric types.
104+
Returns 0 if the input set is empty.
95105

96106
[discrete]
97107
=== Return type
@@ -128,6 +138,7 @@ max([1, 1, 3, 3]) => 3
128138
=== Description
129139

130140
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.
131142

132143
[discrete]
133144
=== Return type
@@ -164,6 +175,7 @@ min([1, 1, 3, 3]) => 1
164175
=== Description
165176

166177
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.
167179

168180
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.
169181

@@ -205,6 +217,7 @@ stdev([1, 2, 3, 4, 5]) => 1.5811388300842
205217
=== Description
206218

207219
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.
208221

209222
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.
210223

@@ -246,6 +259,7 @@ stdevp([1, 2, 3, 4, 5]) => 1.4142135623731
246259
=== Description
247260

248261
Returns the sum of all members in a set or bag. The function can only take set/bag expressions whose members are numeric types.
262+
Returns 0 if the input set is empty.
249263

250264
[discrete]
251265
=== Return type

0 commit comments

Comments
 (0)