A query is grouped when it has a GROUP BY clause or uses aggregates (18.2.4.1).
The SELECT query.
Whether a function call is a custom aggregate.
A query is grouped when it has a GROUP BY clause or uses aggregates (18.2.4.1).