Skip to content

Commit ab521ff

Browse files
authored
Merge pull request #18688 from d10c/d10c/drop-bigint-avg
Update docs to remove BigInt `avg`
2 parents 9319b18 + e455a6c commit ab521ff

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/codeql/ql-language-reference/modules.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ The other built-in operations are:
444444
* bitwise operations: ``.bitAnd(BigInt)``, ``.bitOr(BigInt)``,
445445
``.bitXor(BigInt)``, ``.bitShiftLeft(int)``, ``.bitShiftRightSigned(int)``,
446446
``.bitNot()``, ``.bitLength()``,
447-
* aggregates: ``min``, ``max``, (``strict``)\ ``sum``, (``strict``)\ ``count``, ``avg``,
447+
* aggregates: ``min``, ``max``, (``strict``)\ ``sum``, (``strict``)\ ``count``,
448448
``rank``, ``unique``, ``any``.
449449
* other: ``.pow(int)``, ``.abs()``, ``.gcd(BigInt)``, ``.minimum(BigInt)``,
450450
``.maximum(BigInt)``.

docs/codeql/ql-language-reference/ql-language-specification.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,8 @@ The number and types of the aggregation expressions are restricted as follows:
14451445
- A ``max``, ``min``, ``rank`` or ``unique`` aggregation must have a single expression.
14461446
- The type of the expression in a ``max``, ``min`` or ``rank`` aggregation without an ordering directive expression must be an orderable type.
14471447
- A ``count`` or ``strictcount`` aggregation must not have an expression.
1448-
- A ``sum``, ``strictsum`` or ``avg`` aggregation must have a single aggregation expression, which must have a type which is a subtype of ``float`` or ``QlBuiltins::BigInt``.
1448+
- A ``sum`` or ``strictsum`` aggregation must have a single aggregation expression, which must have a type which is a subtype of ``float`` or ``QlBuiltins::BigInt``.
1449+
- An ``avg`` aggregation must have a single aggregation expression, which must have a type which is a subtype of ``float``.
14491450
- A ``concat`` or ``strictconcat`` aggregation must have two expressions. Both expressions must have types which are subtypes of ``string``.
14501451

14511452
The type of a ``count``, ``strictcount`` aggregation is ``int``. The type of an ``avg`` aggregation is ``float``. The type of a ``concat`` or ``strictconcat`` aggregation is ``string``. The type of a ``sum`` or ``strictsum`` aggregation is ``int`` if the aggregation expression is a subtype of ``int``; otherwise it is ``QlBuiltins::BigInt`` if the aggregation expression is a subtype of ``QlBuiltins::BigInt``; otherwise it is ``float``. The type of a ``rank``, ``min`` or ``max`` aggregation is the type of the single expression.
@@ -1464,7 +1465,7 @@ If the aggregation id is ``max``, ``min`` or ``rank`` and there was no ordering
14641465

14651466
The values of the aggregation expression are given by applying the aggregation function to each set of tuples obtained by picking exactly one aggregation tuple for each range tuple.
14661467

1467-
- If the aggregation id is ``avg``, and the set is non-empty, then the resulting value is the average of the value for the aggregation variable in each tuple in the set, weighted by the number of tuples in the set, after converting the value to its appropriate base type of ``float`` or ``QlBuiltins::BigInt``, then converting the final result to ``float``.
1468+
- If the aggregation id is ``avg``, and the set is non-empty, then the resulting value is the average of the aggregation variable's value in each tuple in the set, converted to ``float`` and weighted by the number of tuples in the set.
14681469

14691470
- If the aggregation id is ``count``, then the resulting value is the number of tuples in the set. If there are no tuples in the set, then the value is the integer ``0``.
14701471

0 commit comments

Comments
 (0)