GroupBy Validation
A GroupBy shape is heavily validated because both the group keys and the aggregations feed the generated SQL GROUP BY / SELECT clauses.
Rules
| Rule | Error Code |
|---|---|
| Must have at least one field | GroupByMustHaveFields |
| Fields must be unique (case-insensitive) | GroupByFieldsMustBeUnique |
| Fields cannot be complex/navigation types | GroupByFieldCannotBeComplexType |
| Fields cannot be collection types | GroupByFieldCannotBeCollectionType |
| Aggregation alias must not be empty and must not contain dots | InvalidAlias |
| Aggregation aliases must be unique | AggregationAliasesMustBeUnique |
| Aggregation alias cannot match a GroupBy field | AggregationAliasCannotBeGroupByField({alias}) |
| Aggregation field must be a simple type | AggregationFieldMustBeSimpleType |
| Aggregation field cannot be a collection | AggregationFieldCannotBeCollectionType |
Sumation / Average only work on numeric fields | UnsupportedAggregatorForType({agg},{type}) |
Minimum / Maximum do not work on Boolean | UnsupportedAggregatorForType({agg},{type}) |
Note
Dotted GroupBy fields like
Category.Name are allowed if the leaf is a simple type. Only the leaf is the actual key; the dotted path is flattened into an alias such as CategoryName in the result. See the Summary example.