Skip to content

Commit fd2904d

Browse files
authored
Merge pull request #8760 from Marcono1234/patch-1
Clarify `min`, `max` and `rank` documentation
2 parents bffa8fa + 6a48ba9 commit fd2904d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ The following aggregates are available in QL:
227227

228228
- ``min`` and ``max``: These aggregates determine the smallest (``min``) or largest (``max``)
229229
value of ``<expression>`` among the possible assignments to the aggregation variables.
230-
In this case, ``<expression>`` must be of numeric type or of type ``string``.
231-
230+
``<expression>`` must be of numeric type or of type ``string``, or an explicit order must be defined with ``order by``.
231+
When using ``order by``, more than one result may exist in case of ties.
232+
232233
For example, the following aggregation returns the name of the ``.js`` file (or files) with the
233234
largest number of lines, using the number of lines of code to break ties:
234235

@@ -297,9 +298,10 @@ The following aggregates are available in QL:
297298
.. index:: rank
298299

299300
- ``rank``: This aggregate takes the possible values of ``<expression>`` and ranks them.
300-
In this case, ``<expression>`` must be of numeric type or of type ``string``. The aggregation
301-
returns the value that is ranked in the position specified by the **rank expression**.
301+
``<expression>`` must be of numeric type or of type ``string``, or an explicit order must be defined with ``order by``.
302+
The aggregation returns the value that is ranked in the position specified by the **rank expression**.
302303
You must include this rank expression in brackets after the keyword ``rank``.
304+
When using ``order by``, more than one result may exist in case of ties.
303305

304306
For example, the following aggregation returns the value that is ranked 4th out of all the
305307
possible values. In this case, ``8`` is the 4th integer in the range from ``5`` through

0 commit comments

Comments
 (0)