Skip to content

Commit 90b82a0

Browse files
authored
unique in aggregate section
1 parent d979bd9 commit 90b82a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/language/ql-spec/language.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,7 @@ An aggregation can be written in one of two forms:
10581058

10591059
aggregation ::= aggid ("[" expr "]")? "(" (var_decls)? ("|" (formula)? ("|" as_exprs ("order" "by" aggorderbys)?)?)? ")"
10601060
| aggid ("[" expr "]")? "(" as_exprs ("order" "by" aggorderbys)? ")"
1061+
| "unique" "(" var_decls "|" (formula)? ("|" as_exprs)? ")"
10611062

10621063
aggid ::= "avg" | "concat" | "count" | "max" | "min" | "rank" | "strictconcat" | "strictcount" | "strictsum" | "sum"
10631064

@@ -1098,7 +1099,7 @@ The typing environment for ordering directives is obtained by taking the typing
10981099

10991100
The number and types of the aggregation expressions are restricted as follows:
11001101

1101-
- A ``max``, ``min`` or ``rank`` aggregation must have a single expression.
1102+
- A ``max``, ``min``, ``rank`` or ``unique`` aggregation must have a single expression.
11021103
- The type of the expression in a ``max``, ``min`` or ``rank`` aggregation without an ordering directive expression must be an orderable type.
11031104
- A ``count`` or ``strictcount`` aggregation must not have an expression.
11041105
- A ``sum``, ``strictsum`` or ``avg`` aggregation must have a single aggregation expression, which must have a type which is a subtype of ``float``.
@@ -1140,6 +1141,8 @@ The values of the aggregation expression are given by applying the aggregation f
11401141

11411142
- If the aggregation id is ``strictconcat``, then the result is the same as for ``concat`` except in the case where there are no aggregation tuples in which case the aggregation has no value.
11421143

1144+
- If the aggregation id is ``unique``, then the result is the the value of the aggregation variable if there is precisely one such value. Otherwise, the aggregation has no value.
1145+
11431146
Any
11441147
~~~
11451148

0 commit comments

Comments
 (0)