← aggr operator page · clause/aggr/attribute_role/attribute_without_measure

Attribute without measure 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

aggr attribute At_1 := max ( Me_1 ) group by Id_1: an attribute as the only aggregated component.

Manual:

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".

Expected:

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".

script.vtl ⇩

DS_r := DS_1 [ aggr attribute At_1 := max ( Me_1 ) group by Id_1 ];

input/DS_1.csv ⇩

Id_1Id_2Me_1
1A1
1B5
2A3
2B4

input/DS_1.json ⇩

{
  "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}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1At_1
15
24

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "At_1", "type": "Integer", "role": "Attribute"}
      ]
    }
  ]
}