← max operator page · aggregate/max/ds_group_by/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

max at data set level grouped by Id_1, over one Integer measure.

Manual:

Maximum value, Example 1, output verbatim: "The operator returns the maximum of the input values."

Expected:

7 for 2011, the greatest of 3, 5 and 7, and 4 for 2012, of 2 and 4; Me_1 stays Integer.

script.vtl ⇩

DS_r := max ( DS_1 group by Id_1 );

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1
2011AXX3
2011AYY5
2011BYY7
2012AXX2
2012BYY4

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Time_Period", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Me_1
20117
20124

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}