← aggr operator page · clause/aggr/attribute_role/attribute_without_measure
pandas ✅ · DuckDB ✅
aggr attribute At_1 := max ( Me_1 ) group by Id_1: an attribute as the only aggregated component.
Aggregation: "The aggr computed Measures and Attributes are the only Measures and Attributes returned in the output Data Set"; the User Manual: "There can be from 0 to N Measures in a Data Structure. A Data Set without Measures is allowed".
Id_1 and the Attribute At_1 = 5 and 4, the maxima, with no Measure: Me_1 is not in the result. At_1 is an Integer, as for max "For numeric operands, the result has the same type as the operand".
DS_r := DS_1 [ aggr attribute At_1 := max ( Me_1 ) group by Id_1 ];
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 1 |
| 1 | B | 5 |
| 2 | A | 3 |
| 2 | B | 4 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | At_1 |
|---|---|
| 1 | 5 |
| 2 | 4 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "At_1", "type": "Integer", "role": "Attribute"}
]
}
]
}